rt2x00: allow to specify watchdog interval
authorStanislaw Gruszka <sgruszka@redhat.com>
Sat, 15 Jun 2019 10:00:54 +0000 (12:00 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 25 Jun 2019 05:10:07 +0000 (08:10 +0300)
Allow subdriver to change watchdog interval by intialize
link->watchdog_interval value before rt2x00link_register().

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ralink/rt2x00/rt2x00.h
drivers/net/wireless/ralink/rt2x00/rt2x00link.c

index 64a792a8fb2c70cd3515d5118f931151a9ddef45..2b551dbe984450c53485b098a9365eaedbdf3893 100644 (file)
@@ -325,6 +325,7 @@ struct link {
         * to bring the device/driver back into the desired state.
         */
        struct delayed_work watchdog_work;
+       unsigned int watchdog_interval;
 
        /*
         * Work structure for scheduling periodic AGC adjustments.
index 939cfa5141c6a1cbd05edc7d1c8be0f0d256e69b..15ebebf88e729d97d5b13a72f06145ad2b70619f 100644 (file)
@@ -387,7 +387,7 @@ void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev)
            rt2x00dev->ops->lib->watchdog)
                ieee80211_queue_delayed_work(rt2x00dev->hw,
                                             &link->watchdog_work,
-                                            WATCHDOG_INTERVAL);
+                                            link->watchdog_interval);
 }
 
 void rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev)
@@ -413,11 +413,16 @@ static void rt2x00link_watchdog(struct work_struct *work)
        if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
                ieee80211_queue_delayed_work(rt2x00dev->hw,
                                             &link->watchdog_work,
-                                            WATCHDOG_INTERVAL);
+                                            link->watchdog_interval);
 }
 
 void rt2x00link_register(struct rt2x00_dev *rt2x00dev)
 {
-       INIT_DELAYED_WORK(&rt2x00dev->link.watchdog_work, rt2x00link_watchdog);
-       INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00link_tuner);
+       struct link *link = &rt2x00dev->link;
+
+       INIT_DELAYED_WORK(&link->work, rt2x00link_tuner);
+       INIT_DELAYED_WORK(&link->watchdog_work, rt2x00link_watchdog);
+
+       if (link->watchdog_interval == 0)
+               link->watchdog_interval = WATCHDOG_INTERVAL;
 }