wifi: rt2x00: make watchdog param per device
authorStanislaw Gruszka <stf_xl@wp.pl>
Sun, 26 Nov 2023 19:53:58 +0000 (20:53 +0100)
committerKalle Valo <kvalo@kernel.org>
Fri, 1 Dec 2023 12:42:14 +0000 (14:42 +0200)
We can run PCI/MMIO devices together with USB devices in the system.
Make watchdog parameter per device to avoid situation when plugin
USB device change modparam_watchdog for PCI/MMIO device.

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Tested-by: Shiji Yang <yangshiji66@outlook.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231126195358.500259-1-stf_xl@wp.pl
drivers/net/wireless/ralink/rt2x00/rt2800lib.c
drivers/net/wireless/ralink/rt2x00/rt2x00.h
drivers/net/wireless/ralink/rt2x00/rt2x00link.c

index 485096e3be9419169022fb384a7607b3ff702895..aaf31857ae1efb2d50d623a43be0ccdbdba9240e 100644 (file)
@@ -1353,10 +1353,10 @@ void rt2800_watchdog(struct rt2x00_dev *rt2x00dev)
        if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags))
                return;
 
-       if (modparam_watchdog & RT2800_WATCHDOG_DMA_BUSY)
+       if (rt2x00dev->link.watchdog & RT2800_WATCHDOG_DMA_BUSY)
                reset = rt2800_watchdog_dma_busy(rt2x00dev);
 
-       if (modparam_watchdog & RT2800_WATCHDOG_HANG)
+       if (rt2x00dev->link.watchdog & RT2800_WATCHDOG_HANG)
                reset = rt2800_watchdog_hung(rt2x00dev) || reset;
 
        if (reset)
@@ -12065,14 +12065,13 @@ int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
                __set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags);
        }
 
+       rt2x00dev->link.watchdog = modparam_watchdog;
        /* USB NICs don't support DMA watchdog as INT_SOURCE_CSR is invalid */
        if (rt2x00_is_usb(rt2x00dev))
-               modparam_watchdog &= ~RT2800_WATCHDOG_DMA_BUSY;
-       if (modparam_watchdog) {
+               rt2x00dev->link.watchdog &= ~RT2800_WATCHDOG_DMA_BUSY;
+       if (rt2x00dev->link.watchdog) {
                __set_bit(CAPABILITY_RESTART_HW, &rt2x00dev->cap_flags);
                rt2x00dev->link.watchdog_interval = msecs_to_jiffies(100);
-       } else {
-               rt2x00dev->link.watchdog_disabled = true;
        }
 
        /*
index 62fed38f41c08023672f902e02a5d0e377594cc3..82af01448a0a8d2da7a20ae0cbb0e614875957a6 100644 (file)
@@ -334,7 +334,7 @@ struct link {
         */
        struct delayed_work watchdog_work;
        unsigned int watchdog_interval;
-       bool watchdog_disabled;
+       unsigned int watchdog;
 
        /*
         * Work structure for scheduling periodic AGC adjustments.
index 6cf7e7c997c2bce59816a60ac0fab438983edcfb..fb23d409fba87d84e16020b51080306009a25a75 100644 (file)
@@ -384,7 +384,7 @@ void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev)
        struct link *link = &rt2x00dev->link;
 
        if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) &&
-           rt2x00dev->ops->lib->watchdog && !link->watchdog_disabled)
+           rt2x00dev->ops->lib->watchdog && link->watchdog)
                ieee80211_queue_delayed_work(rt2x00dev->hw,
                                             &link->watchdog_work,
                                             link->watchdog_interval);