diff options
Diffstat (limited to 'net/mac80211/led.c')
-rw-r--r-- | net/mac80211/led.c | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/net/mac80211/led.c b/net/mac80211/led.c index 79b13090aed7..4905eb8af572 100644 --- a/net/mac80211/led.c +++ b/net/mac80211/led.c | |||
@@ -216,7 +216,7 @@ static void tpt_trig_timer(unsigned long data) | |||
216 | } | 216 | } |
217 | 217 | ||
218 | extern char *__ieee80211_create_tpt_led_trigger( | 218 | extern char *__ieee80211_create_tpt_led_trigger( |
219 | struct ieee80211_hw *hw, | 219 | struct ieee80211_hw *hw, unsigned int flags, |
220 | const struct ieee80211_tpt_blink *blink_table, | 220 | const struct ieee80211_tpt_blink *blink_table, |
221 | unsigned int blink_table_len) | 221 | unsigned int blink_table_len) |
222 | { | 222 | { |
@@ -237,6 +237,7 @@ extern char *__ieee80211_create_tpt_led_trigger( | |||
237 | 237 | ||
238 | tpt_trig->blink_table = blink_table; | 238 | tpt_trig->blink_table = blink_table; |
239 | tpt_trig->blink_table_len = blink_table_len; | 239 | tpt_trig->blink_table_len = blink_table_len; |
240 | tpt_trig->want = flags; | ||
240 | 241 | ||
241 | setup_timer(&tpt_trig->timer, tpt_trig_timer, (unsigned long)local); | 242 | setup_timer(&tpt_trig->timer, tpt_trig_timer, (unsigned long)local); |
242 | 243 | ||
@@ -246,11 +247,11 @@ extern char *__ieee80211_create_tpt_led_trigger( | |||
246 | } | 247 | } |
247 | EXPORT_SYMBOL(__ieee80211_create_tpt_led_trigger); | 248 | EXPORT_SYMBOL(__ieee80211_create_tpt_led_trigger); |
248 | 249 | ||
249 | void ieee80211_start_tpt_led_trig(struct ieee80211_local *local) | 250 | static void ieee80211_start_tpt_led_trig(struct ieee80211_local *local) |
250 | { | 251 | { |
251 | struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; | 252 | struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; |
252 | 253 | ||
253 | if (!tpt_trig) | 254 | if (tpt_trig->running) |
254 | return; | 255 | return; |
255 | 256 | ||
256 | /* reset traffic */ | 257 | /* reset traffic */ |
@@ -261,12 +262,12 @@ void ieee80211_start_tpt_led_trig(struct ieee80211_local *local) | |||
261 | mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ)); | 262 | mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ)); |
262 | } | 263 | } |
263 | 264 | ||
264 | void ieee80211_stop_tpt_led_trig(struct ieee80211_local *local) | 265 | static void ieee80211_stop_tpt_led_trig(struct ieee80211_local *local) |
265 | { | 266 | { |
266 | struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; | 267 | struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; |
267 | struct led_classdev *led_cdev; | 268 | struct led_classdev *led_cdev; |
268 | 269 | ||
269 | if (!tpt_trig) | 270 | if (!tpt_trig->running) |
270 | return; | 271 | return; |
271 | 272 | ||
272 | tpt_trig->running = false; | 273 | tpt_trig->running = false; |
@@ -277,3 +278,31 @@ void ieee80211_stop_tpt_led_trig(struct ieee80211_local *local) | |||
277 | led_brightness_set(led_cdev, LED_OFF); | 278 | led_brightness_set(led_cdev, LED_OFF); |
278 | read_unlock(&tpt_trig->trig.leddev_list_lock); | 279 | read_unlock(&tpt_trig->trig.leddev_list_lock); |
279 | } | 280 | } |
281 | |||
282 | void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, | ||
283 | unsigned int types_on, unsigned int types_off) | ||
284 | { | ||
285 | struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; | ||
286 | bool allowed; | ||
287 | |||
288 | WARN_ON(types_on & types_off); | ||
289 | |||
290 | if (!tpt_trig) | ||
291 | return; | ||
292 | |||
293 | tpt_trig->active &= ~types_off; | ||
294 | tpt_trig->active |= types_on; | ||
295 | |||
296 | /* | ||
297 | * Regardless of wanted state, we shouldn't blink when | ||
298 | * the radio is disabled -- this can happen due to some | ||
299 | * code ordering issues with __ieee80211_recalc_idle() | ||
300 | * being called before the radio is started. | ||
301 | */ | ||
302 | allowed = tpt_trig->active & IEEE80211_TPT_LEDTRIG_FL_RADIO; | ||
303 | |||
304 | if (!allowed || !(tpt_trig->active & tpt_trig->want)) | ||
305 | ieee80211_stop_tpt_led_trig(local); | ||
306 | else | ||
307 | ieee80211_start_tpt_led_trig(local); | ||
308 | } | ||