diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00link.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00link.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c index 9acfc5c70389..666cef3f8472 100644 --- a/drivers/net/wireless/rt2x00/rt2x00link.c +++ b/drivers/net/wireless/rt2x00/rt2x00link.c | |||
@@ -407,7 +407,45 @@ static void rt2x00link_tuner(struct work_struct *work) | |||
407 | &link->work, LINK_TUNE_INTERVAL); | 407 | &link->work, LINK_TUNE_INTERVAL); |
408 | } | 408 | } |
409 | 409 | ||
410 | void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev) | ||
411 | { | ||
412 | struct link *link = &rt2x00dev->link; | ||
413 | |||
414 | if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) || | ||
415 | !test_bit(DRIVER_SUPPORT_WATCHDOG, &rt2x00dev->flags)) | ||
416 | return; | ||
417 | |||
418 | ieee80211_queue_delayed_work(rt2x00dev->hw, | ||
419 | &link->watchdog_work, WATCHDOG_INTERVAL); | ||
420 | } | ||
421 | |||
422 | void rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev) | ||
423 | { | ||
424 | cancel_delayed_work_sync(&rt2x00dev->link.watchdog_work); | ||
425 | } | ||
426 | |||
427 | static void rt2x00link_watchdog(struct work_struct *work) | ||
428 | { | ||
429 | struct rt2x00_dev *rt2x00dev = | ||
430 | container_of(work, struct rt2x00_dev, link.watchdog_work.work); | ||
431 | struct link *link = &rt2x00dev->link; | ||
432 | |||
433 | /* | ||
434 | * When the radio is shutting down we should | ||
435 | * immediately cease the watchdog monitoring. | ||
436 | */ | ||
437 | if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) | ||
438 | return; | ||
439 | |||
440 | rt2x00dev->ops->lib->watchdog(rt2x00dev); | ||
441 | |||
442 | if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) | ||
443 | ieee80211_queue_delayed_work(rt2x00dev->hw, | ||
444 | &link->watchdog_work, WATCHDOG_INTERVAL); | ||
445 | } | ||
446 | |||
410 | void rt2x00link_register(struct rt2x00_dev *rt2x00dev) | 447 | void rt2x00link_register(struct rt2x00_dev *rt2x00dev) |
411 | { | 448 | { |
449 | INIT_DELAYED_WORK(&rt2x00dev->link.watchdog_work, rt2x00link_watchdog); | ||
412 | INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00link_tuner); | 450 | INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00link_tuner); |
413 | } | 451 | } |