]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mt76: connac: alaways wake the device before scanning
authorLorenzo Bianconi <lorenzo@kernel.org>
Sun, 18 Apr 2021 16:45:39 +0000 (18:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:59:56 +0000 (16:59 +0200)
[ Upstream commit a61826203ba8806b4cdffd36bafdce3e9ad35c24 ]

move scanning check from mt76_connac_power_save_sched routine
to mt7921_pm_power_save_work/mt7615_pm_power_save_work ones

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/mediatek/mt76/mt7615/mac.c
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
drivers/net/wireless/mediatek/mt76/mt7921/mac.c

index 8dccb589b756d809c24832b7382658c0c68d5a4b..d06e61cadc4118059fcd96ac849074d5f4d64cdd 100644 (file)
@@ -1890,6 +1890,10 @@ void mt7615_pm_power_save_work(struct work_struct *work)
                                                pm.ps_work.work);
 
        delta = dev->pm.idle_timeout;
+       if (test_bit(MT76_HW_SCANNING, &dev->mphy.state) ||
+           test_bit(MT76_HW_SCHED_SCANNING, &dev->mphy.state))
+               goto out;
+
        if (time_is_after_jiffies(dev->pm.last_activity + delta)) {
                delta = dev->pm.last_activity + delta - jiffies;
                goto out;
index c5f5037f57570eb87c9539703752747712b2ba9d..cff60b699e3196f5c5a155ef4a484b925d149a8a 100644 (file)
@@ -16,10 +16,6 @@ int mt76_connac_pm_wake(struct mt76_phy *phy, struct mt76_connac_pm *pm)
        if (!test_bit(MT76_STATE_PM, &phy->state))
                return 0;
 
-       if (test_bit(MT76_HW_SCANNING, &phy->state) ||
-           test_bit(MT76_HW_SCHED_SCANNING, &phy->state))
-               return 0;
-
        if (queue_work(dev->wq, &pm->wake_work))
                reinit_completion(&pm->wake_cmpl);
 
@@ -45,10 +41,6 @@ void mt76_connac_power_save_sched(struct mt76_phy *phy,
 
        pm->last_activity = jiffies;
 
-       if (test_bit(MT76_HW_SCANNING, &phy->state) ||
-           test_bit(MT76_HW_SCHED_SCANNING, &phy->state))
-               return;
-
        if (!test_bit(MT76_STATE_PM, &phy->state))
                queue_delayed_work(dev->wq, &pm->ps_work, pm->idle_timeout);
 }
index 39be2e39626981fb80837ba604f9a976e39f36b3..c4b144391a8e2be4f6ecd41af3976b8986ff25b0 100644 (file)
@@ -1524,6 +1524,10 @@ void mt7921_pm_power_save_work(struct work_struct *work)
                                                pm.ps_work.work);
 
        delta = dev->pm.idle_timeout;
+       if (test_bit(MT76_HW_SCANNING, &dev->mphy.state) ||
+           test_bit(MT76_HW_SCHED_SCANNING, &dev->mphy.state))
+               goto out;
+
        if (time_is_after_jiffies(dev->pm.last_activity + delta)) {
                delta = dev->pm.last_activity + delta - jiffies;
                goto out;