mt76: move mac_work in mt76_core module
authorLorenzo Bianconi <lorenzo@kernel.org>
Mon, 4 Jan 2021 18:00:05 +0000 (02:00 +0800)
committerFelix Fietkau <nbd@nbd.name>
Tue, 26 Jan 2021 19:07:48 +0000 (20:07 +0100)
Move mac_work delayed_work and mac_work_count in mt76_phy since it is
used by all drivers. This is a preliminary patch to create a common mcu
library used by mt7615 and mt7921 drivers

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
22 files changed:
drivers/net/wireless/mediatek/mt76/mt76.h
drivers/net/wireless/mediatek/mt76/mt7603/init.c
drivers/net/wireless/mediatek/mt76/mt7603/mac.c
drivers/net/wireless/mediatek/mt76/mt7603/main.c
drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h
drivers/net/wireless/mediatek/mt76/mt7615/init.c
drivers/net/wireless/mediatek/mt76/mt7615/mac.c
drivers/net/wireless/mediatek/mt76/mt7615/main.c
drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
drivers/net/wireless/mediatek/mt76/mt7615/usb.c
drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
drivers/net/wireless/mediatek/mt76/mt76x02_util.c
drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
drivers/net/wireless/mediatek/mt76/mt7915/init.c
drivers/net/wireless/mediatek/mt76/mt7915/mac.c
drivers/net/wireless/mediatek/mt76/mt7915/main.c
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h

index 10034c21f812b4cdd777b434da428c99a8620922..52228936f79295a1e5cc6d4257e197cc4fd13082 100644 (file)
@@ -583,6 +583,9 @@ struct mt76_phy {
 #ifdef CONFIG_NL80211_TESTMODE
        struct mt76_testmode_data test;
 #endif
+
+       struct delayed_work mac_work;
+       u8 mac_work_count;
 };
 
 struct mt76_dev {
@@ -623,7 +626,6 @@ struct mt76_dev {
 
        struct mt76_worker tx_worker;
        struct napi_struct tx_napi;
-       struct delayed_work mac_work;
 
        wait_queue_head_t tx_wait;
        struct sk_buff_head status_list;
index b14e08046e209a84403e5433f36867bbffe8926a..f0b879c3eba87cd785d48c797493d44012d5f4e9 100644 (file)
@@ -532,7 +532,7 @@ int mt7603_register_device(struct mt7603_dev *dev)
        spin_lock_init(&dev->sta_poll_lock);
        spin_lock_init(&dev->ps_lock);
 
-       INIT_DELAYED_WORK(&dev->mt76.mac_work, mt7603_mac_work);
+       INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7603_mac_work);
        tasklet_setup(&dev->mt76.pre_tbtt_tasklet, mt7603_pre_tbtt_tasklet);
 
        dev->slottime = 9;
index 55095e66f2efba071b29e9d9189af6d53584f4b7..7f0e3df3a0948f1f1fded40bf745c1b7d198c7ff 100644 (file)
@@ -1788,7 +1788,7 @@ out:
 void mt7603_mac_work(struct work_struct *work)
 {
        struct mt7603_dev *dev = container_of(work, struct mt7603_dev,
-                                             mt76.mac_work.work);
+                                             mphy.mac_work.work);
        bool reset = false;
        int i, idx;
 
@@ -1796,7 +1796,7 @@ void mt7603_mac_work(struct work_struct *work)
 
        mutex_lock(&dev->mt76.mutex);
 
-       dev->mac_work_count++;
+       dev->mphy.mac_work_count++;
        mt76_update_survey(&dev->mt76);
        mt7603_edcca_check(dev);
 
@@ -1807,7 +1807,7 @@ void mt7603_mac_work(struct work_struct *work)
                dev->mt76.aggr_stats[idx++] += val >> 16;
        }
 
-       if (dev->mac_work_count == 10)
+       if (dev->mphy.mac_work_count == 10)
                mt7603_false_cca_check(dev);
 
        if (mt7603_watchdog_check(dev, &dev->rx_pse_check,
@@ -1838,17 +1838,17 @@ void mt7603_mac_work(struct work_struct *work)
                dev->rx_dma_idx = ~0;
                memset(dev->tx_dma_idx, 0xff, sizeof(dev->tx_dma_idx));
                reset = true;
-               dev->mac_work_count = 0;
+               dev->mphy.mac_work_count = 0;
        }
 
-       if (dev->mac_work_count >= 10)
-               dev->mac_work_count = 0;
+       if (dev->mphy.mac_work_count >= 10)
+               dev->mphy.mac_work_count = 0;
 
        mutex_unlock(&dev->mt76.mutex);
 
        if (reset)
                mt7603_mac_watchdog_reset(dev);
 
-       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
+       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
                                     msecs_to_jiffies(MT7603_WATCHDOG_TIME));
 }
index 6d47b57cbc39bd2831ec26f51234ecd6e2b37064..d7e4bb29f5bba4c972a170840f96390ae1e3b831 100644 (file)
@@ -17,7 +17,7 @@ mt7603_start(struct ieee80211_hw *hw)
        mt7603_mac_start(dev);
        dev->mphy.survey_time = ktime_get_boottime();
        set_bit(MT76_STATE_RUNNING, &dev->mphy.state);
-       mt7603_mac_work(&dev->mt76.mac_work.work);
+       mt7603_mac_work(&dev->mphy.mac_work.work);
 
        return 0;
 }
@@ -28,7 +28,7 @@ mt7603_stop(struct ieee80211_hw *hw)
        struct mt7603_dev *dev = hw->priv;
 
        clear_bit(MT76_STATE_RUNNING, &dev->mphy.state);
-       cancel_delayed_work_sync(&dev->mt76.mac_work);
+       cancel_delayed_work_sync(&dev->mphy.mac_work);
        mt7603_mac_stop(dev);
 }
 
@@ -137,7 +137,7 @@ mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
        u8 bw = MT_BW_20;
        bool failed = false;
 
-       cancel_delayed_work_sync(&dev->mt76.mac_work);
+       cancel_delayed_work_sync(&dev->mphy.mac_work);
        tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
 
        mutex_lock(&dev->mt76.mutex);
@@ -178,7 +178,7 @@ mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
 
        mt76_txq_schedule_all(&dev->mphy);
 
-       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
+       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
                                     msecs_to_jiffies(MT7603_WATCHDOG_TIME));
 
        /* reset channel stats */
@@ -200,7 +200,7 @@ out:
        tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
 
        if (failed)
-               mt7603_mac_work(&dev->mt76.mac_work.work);
+               mt7603_mac_work(&dev->mphy.mac_work.work);
 
        return ret;
 }
index 6e0a92a28b1cbbfa00f0273f6474b8f53fe36b7f..b787c56fd8d67edd6a2d3dcbe841f7a4a33c4130 100644 (file)
@@ -132,8 +132,6 @@ struct mt7603_dev {
 
        spinlock_t ps_lock;
 
-       u8 mac_work_count;
-
        u8 mcu_running;
 
        u8 ed_monitor_enabled;
index a73b76e57c7fed7193d5db84d0f63c23c84091fc..d89b607cce68a8496101089eee66e57eeaab363e 100644 (file)
@@ -408,7 +408,7 @@ int mt7615_register_ext_phy(struct mt7615_dev *dev)
        mphy->antenna_mask = BIT(hweight8(phy->chainmask)) - 1;
        mt7615_init_wiphy(mphy->hw);
 
-       INIT_DELAYED_WORK(&phy->mac_work, mt7615_mac_work);
+       INIT_DELAYED_WORK(&mphy->mac_work, mt7615_mac_work);
        INIT_DELAYED_WORK(&phy->scan_work, mt7615_scan_work);
        skb_queue_head_init(&phy->scan_event_list);
 
@@ -471,7 +471,7 @@ void mt7615_init_device(struct mt7615_dev *dev)
        init_completion(&dev->pm.wake_cmpl);
        spin_lock_init(&dev->pm.txq_lock);
        set_bit(MT76_STATE_PM, &dev->mphy.state);
-       INIT_DELAYED_WORK(&dev->phy.mac_work, mt7615_mac_work);
+       INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7615_mac_work);
        INIT_DELAYED_WORK(&dev->phy.scan_work, mt7615_scan_work);
        skb_queue_head_init(&dev->phy.scan_event_list);
        INIT_LIST_HEAD(&dev->sta_poll_list);
index 5d2a14cf5d403bbf26fb36dbbde368e76e3bf557..2cc329019edcf9c4e5782d9f0fef8a8227c147c7 100644 (file)
@@ -1976,17 +1976,17 @@ out:
 void mt7615_mac_work(struct work_struct *work)
 {
        struct mt7615_phy *phy;
-       struct mt76_dev *mdev;
+       struct mt76_phy *mphy;
 
-       phy = (struct mt7615_phy *)container_of(work, struct mt7615_phy,
-                                               mac_work.work);
-       mdev = &phy->dev->mt76;
+       mphy = (struct mt76_phy *)container_of(work, struct mt76_phy,
+                                              mac_work.work);
+       phy = mphy->priv;
 
        mt7615_mutex_acquire(phy->dev);
 
        mt7615_update_survey(phy->dev);
-       if (++phy->mac_work_count == 5) {
-               phy->mac_work_count = 0;
+       if (++mphy->mac_work_count == 5) {
+               mphy->mac_work_count = 0;
 
                mt7615_mac_update_mib_stats(phy);
                mt7615_mac_scs_check(phy);
@@ -1994,8 +1994,8 @@ void mt7615_mac_work(struct work_struct *work)
 
        mt7615_mutex_release(phy->dev);
 
-       mt76_tx_status_check(mdev, NULL, false);
-       ieee80211_queue_delayed_work(phy->mt76->hw, &phy->mac_work,
+       mt76_tx_status_check(mphy->dev, NULL, false);
+       ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
                                     MT7615_WATCHDOG_TIME);
 }
 
@@ -2104,11 +2104,11 @@ void mt7615_mac_reset_work(struct work_struct *work)
        set_bit(MT76_RESET, &dev->mphy.state);
        set_bit(MT76_MCU_RESET, &dev->mphy.state);
        wake_up(&dev->mt76.mcu.wait);
-       cancel_delayed_work_sync(&dev->phy.mac_work);
+       cancel_delayed_work_sync(&dev->mphy.mac_work);
        del_timer_sync(&dev->phy.roc_timer);
        cancel_work_sync(&dev->phy.roc_work);
        if (phy2) {
-               cancel_delayed_work_sync(&phy2->mac_work);
+               cancel_delayed_work_sync(&phy2->mt76->mac_work);
                del_timer_sync(&phy2->roc_timer);
                cancel_work_sync(&phy2->roc_work);
        }
@@ -2163,10 +2163,11 @@ void mt7615_mac_reset_work(struct work_struct *work)
 
        mt7615_mutex_release(dev);
 
-       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->phy.mac_work,
+       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
                                     MT7615_WATCHDOG_TIME);
        if (phy2)
-               ieee80211_queue_delayed_work(ext_phy->hw, &phy2->mac_work,
+               ieee80211_queue_delayed_work(ext_phy->hw,
+                                            &phy2->mt76->mac_work,
                                             MT7615_WATCHDOG_TIME);
 
 }
index 3fc48aaa3b36c2a01fc2a588cab3467bd3f22854..a7155509f95ac74d8a844694f241ee58382a17cd 100644 (file)
@@ -70,7 +70,7 @@ static int mt7615_start(struct ieee80211_hw *hw)
 
        set_bit(MT76_STATE_RUNNING, &phy->mt76->state);
 
-       ieee80211_queue_delayed_work(hw, &phy->mac_work,
+       ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work,
                                     MT7615_WATCHDOG_TIME);
 
        if (!running)
@@ -86,7 +86,7 @@ static void mt7615_stop(struct ieee80211_hw *hw)
        struct mt7615_dev *dev = mt7615_hw_dev(hw);
        struct mt7615_phy *phy = mt7615_hw_phy(hw);
 
-       cancel_delayed_work_sync(&phy->mac_work);
+       cancel_delayed_work_sync(&phy->mt76->mac_work);
        del_timer_sync(&phy->roc_timer);
        cancel_work_sync(&phy->roc_work);
 
@@ -300,7 +300,7 @@ int mt7615_set_channel(struct mt7615_phy *phy)
        bool ext_phy = phy != &dev->phy;
        int ret;
 
-       cancel_delayed_work_sync(&phy->mac_work);
+       cancel_delayed_work_sync(&phy->mt76->mac_work);
 
        mt7615_mutex_acquire(dev);
 
@@ -335,7 +335,8 @@ out:
        mt76_txq_schedule_all(phy->mt76);
 
        if (!mt76_testmode_enabled(phy->mt76))
-               ieee80211_queue_delayed_work(phy->mt76->hw, &phy->mac_work,
+               ieee80211_queue_delayed_work(phy->mt76->hw,
+                                            &phy->mt76->mac_work,
                                             MT7615_WATCHDOG_TIME);
 
        return ret;
@@ -1112,7 +1113,7 @@ static int mt7615_suspend(struct ieee80211_hw *hw,
 
        clear_bit(MT76_STATE_RUNNING, &phy->mt76->state);
        cancel_delayed_work_sync(&phy->scan_work);
-       cancel_delayed_work_sync(&phy->mac_work);
+       cancel_delayed_work_sync(&phy->mt76->mac_work);
 
        set_bit(MT76_STATE_SUSPEND, &phy->mt76->state);
        ieee80211_iterate_active_interfaces(hw,
@@ -1153,7 +1154,7 @@ static int mt7615_resume(struct ieee80211_hw *hw)
                                            IEEE80211_IFACE_ITER_RESUME_ALL,
                                            mt7615_mcu_set_suspend_iter, phy);
 
-       ieee80211_queue_delayed_work(hw, &phy->mac_work,
+       ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work,
                                     MT7615_WATCHDOG_TIME);
 
        mt7615_mutex_release(dev);
index 979c5c7fe93c621df695393ee4d457c1b7c6691a..99365807142e39ef778bc33316f1ce5d131af605 100644 (file)
@@ -185,9 +185,6 @@ struct mt7615_phy {
 
        struct mib_stats mib;
 
-       struct delayed_work mac_work;
-       u8 mac_work_count;
-
        struct sk_buff_head scan_event_list;
        struct delayed_work scan_work;
 
index a60cfa3455217b9079942e98ab5a69e6b4a2e2e5..dbf59f1ccda22e552a543c9131187a3408174cb2 100644 (file)
@@ -29,7 +29,7 @@ static void mt7663u_stop(struct ieee80211_hw *hw)
        del_timer_sync(&phy->roc_timer);
        cancel_work_sync(&phy->roc_work);
        cancel_delayed_work_sync(&phy->scan_work);
-       cancel_delayed_work_sync(&phy->mac_work);
+       cancel_delayed_work_sync(&phy->mt76->mac_work);
        mt76u_stop_tx(&dev->mt76);
 }
 
index b87d8e136cb9af3730a5d5df649767a2caf053b3..02d0aa0b815e998eaab4760e182c314ed3682779 100644 (file)
@@ -16,7 +16,7 @@ static int mt76x0e_start(struct ieee80211_hw *hw)
 
        mt76x02_mac_start(dev);
        mt76x0_phy_calibrate(dev, true);
-       ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mt76.mac_work,
+       ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mphy.mac_work,
                                     MT_MAC_WORK_INTERVAL);
        ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
                                     MT_CALIBRATE_INTERVAL);
@@ -28,7 +28,7 @@ static int mt76x0e_start(struct ieee80211_hw *hw)
 static void mt76x0e_stop_hw(struct mt76x02_dev *dev)
 {
        cancel_delayed_work_sync(&dev->cal_work);
-       cancel_delayed_work_sync(&dev->mt76.mac_work);
+       cancel_delayed_work_sync(&dev->mphy.mac_work);
        clear_bit(MT76_RESTART, &dev->mphy.state);
 
        if (!mt76_poll(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_TX_DMA_BUSY,
index b12cb17cb43d897a224120eec0e4476870fa9ab2..a593a7796d2356d35e2bdfd7024cb6cc3ebd11d3 100644 (file)
@@ -82,7 +82,7 @@ static void mt76x0u_stop(struct ieee80211_hw *hw)
 
        clear_bit(MT76_STATE_RUNNING, &dev->mphy.state);
        cancel_delayed_work_sync(&dev->cal_work);
-       cancel_delayed_work_sync(&dev->mt76.mac_work);
+       cancel_delayed_work_sync(&dev->mphy.mac_work);
        mt76u_stop_tx(&dev->mt76);
        mt76x02u_exit_beacon_config(dev);
 
@@ -108,7 +108,7 @@ static int mt76x0u_start(struct ieee80211_hw *hw)
                return ret;
 
        mt76x0_phy_calibrate(dev, true);
-       ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mt76.mac_work,
+       ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mphy.mac_work,
                                     MT_MAC_WORK_INTERVAL);
        ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
                                     MT_CALIBRATE_INTERVAL);
index 16b40a73fd1fadf5987b6ac2b49606a8241a6005..e0c4e1981e5bf294a3cc87a4251a13bc9ec3ec7a 100644 (file)
@@ -1162,7 +1162,7 @@ static void mt76x02_edcca_check(struct mt76x02_dev *dev)
 void mt76x02_mac_work(struct work_struct *work)
 {
        struct mt76x02_dev *dev = container_of(work, struct mt76x02_dev,
-                                              mt76.mac_work.work);
+                                              mphy.mac_work.work);
        int i, idx;
 
        mutex_lock(&dev->mt76.mutex);
@@ -1185,7 +1185,7 @@ void mt76x02_mac_work(struct work_struct *work)
 
        mt76_tx_status_check(&dev->mt76, NULL, false);
 
-       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
+       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
                                     MT_MAC_WORK_INTERVAL);
 }
 
index 7ac20d3c16d71de0aa7e2c4088c65e26c9125745..db7bd35d425ce69c13ad328ba786a5b6e862dee6 100644 (file)
@@ -149,7 +149,7 @@ void mt76x02_init_device(struct mt76x02_dev *dev)
        struct ieee80211_hw *hw = mt76_hw(dev);
        struct wiphy *wiphy = hw->wiphy;
 
-       INIT_DELAYED_WORK(&dev->mt76.mac_work, mt76x02_mac_work);
+       INIT_DELAYED_WORK(&dev->mphy.mac_work, mt76x02_mac_work);
 
        hw->queues = 4;
        hw->max_rates = 1;
index 620484390418d207ce99526629e2c3b9134227dd..c6fa8cf92529923c05c7c0cec4ee1702620272a4 100644 (file)
@@ -271,7 +271,7 @@ static int mt76x2_init_hardware(struct mt76x02_dev *dev)
 void mt76x2_stop_hardware(struct mt76x02_dev *dev)
 {
        cancel_delayed_work_sync(&dev->cal_work);
-       cancel_delayed_work_sync(&dev->mt76.mac_work);
+       cancel_delayed_work_sync(&dev->mphy.mac_work);
        cancel_delayed_work_sync(&dev->wdt_work);
        clear_bit(MT76_RESTART, &dev->mphy.state);
        mt76x02_mcu_set_radio_state(dev, false);
index 98f4cf3983207bffbd06d083c7e0f7eea297682d..93fa3f644bb8785cfe01be41f1afe786485c4599 100644 (file)
@@ -14,7 +14,7 @@ mt76x2_start(struct ieee80211_hw *hw)
        mt76x02_mac_start(dev);
        mt76x2_phy_start(dev);
 
-       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
+       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
                                     MT_MAC_WORK_INTERVAL);
        ieee80211_queue_delayed_work(mt76_hw(dev), &dev->wdt_work,
                                     MT_WATCHDOG_TIME);
index ffc2deba29ac66a8335f8627b34bf03dee63463d..85dcdc22fbebf385818815be17fa6a0ef522aee5 100644 (file)
@@ -236,7 +236,7 @@ fail:
 void mt76x2u_stop_hw(struct mt76x02_dev *dev)
 {
        cancel_delayed_work_sync(&dev->cal_work);
-       cancel_delayed_work_sync(&dev->mt76.mac_work);
+       cancel_delayed_work_sync(&dev->mphy.mac_work);
        mt76x2u_mac_stop(dev);
 }
 
index bab4e6e1904ea2f4eadcdf13ae70ed224fea9c09..b66836928d9dc1637be2c20f9dab5b3de8f3cd31 100644 (file)
@@ -15,7 +15,7 @@ static int mt76x2u_start(struct ieee80211_hw *hw)
        if (ret)
                return ret;
 
-       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
+       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
                                     MT_MAC_WORK_INTERVAL);
        set_bit(MT76_STATE_RUNNING, &dev->mphy.state);
 
index 2ec18aaa828075a4c89c15d53eddded52974b4df..8aa26be936e6bece23e1e8e3d92d4895433b09fd 100644 (file)
@@ -240,7 +240,7 @@ static int mt7915_register_ext_phy(struct mt7915_dev *dev)
        mt7915_init_wiphy(mphy->hw);
 
        INIT_LIST_HEAD(&phy->stats_list);
-       INIT_DELAYED_WORK(&phy->mac_work, mt7915_mac_work);
+       INIT_DELAYED_WORK(&mphy->mac_work, mt7915_mac_work);
 
        mt7915_eeprom_parse_band_config(phy);
        mt7915_set_stream_vht_txbf_caps(phy);
@@ -622,7 +622,7 @@ int mt7915_register_device(struct mt7915_dev *dev)
        dev->mt76.phy.priv = &dev->phy;
        INIT_LIST_HEAD(&dev->phy.stats_list);
        INIT_WORK(&dev->rc_work, mt7915_mac_sta_rc_work);
-       INIT_DELAYED_WORK(&dev->phy.mac_work, mt7915_mac_work);
+       INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7915_mac_work);
        INIT_LIST_HEAD(&dev->sta_rc_list);
        INIT_LIST_HEAD(&dev->sta_poll_list);
        spin_lock_init(&dev->sta_poll_lock);
index dc1f56fb823d8019fe9a32b92c4b45c31971cddd..cdc4b3ed5259056444ebf8c7a61bf13e9812770d 100644 (file)
@@ -1544,9 +1544,9 @@ void mt7915_mac_reset_work(struct work_struct *work)
        set_bit(MT76_RESET, &dev->mphy.state);
        set_bit(MT76_MCU_RESET, &dev->mphy.state);
        wake_up(&dev->mt76.mcu.wait);
-       cancel_delayed_work_sync(&dev->phy.mac_work);
+       cancel_delayed_work_sync(&dev->mphy.mac_work);
        if (phy2)
-               cancel_delayed_work_sync(&phy2->mac_work);
+               cancel_delayed_work_sync(&phy2->mt76->mac_work);
 
        /* lock/unlock all queues to ensure that no tx is pending */
        mt76_txq_schedule_all(&dev->mphy);
@@ -1600,10 +1600,11 @@ void mt7915_mac_reset_work(struct work_struct *work)
 
        mt7915_update_beacons(dev);
 
-       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->phy.mac_work,
+       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work,
                                     MT7915_WATCHDOG_TIME);
        if (phy2)
-               ieee80211_queue_delayed_work(ext_phy->hw, &phy2->mac_work,
+               ieee80211_queue_delayed_work(ext_phy->hw,
+                                            &phy2->mt76->mac_work,
                                             MT7915_WATCHDOG_TIME);
 }
 
@@ -1714,17 +1715,17 @@ void mt7915_mac_sta_rc_work(struct work_struct *work)
 void mt7915_mac_work(struct work_struct *work)
 {
        struct mt7915_phy *phy;
-       struct mt76_dev *mdev;
+       struct mt76_phy *mphy;
 
-       phy = (struct mt7915_phy *)container_of(work, struct mt7915_phy,
-                                               mac_work.work);
-       mdev = &phy->dev->mt76;
+       mphy = (struct mt76_phy *)container_of(work, struct mt76_phy,
+                                              mac_work.work);
+       phy = mphy->priv;
 
-       mutex_lock(&mdev->mutex);
+       mutex_lock(&mphy->dev->mutex);
 
-       mt76_update_survey(mdev);
-       if (++phy->mac_work_count == 5) {
-               phy->mac_work_count = 0;
+       mt76_update_survey(mphy->dev);
+       if (++mphy->mac_work_count == 5) {
+               mphy->mac_work_count = 0;
 
                mt7915_mac_update_mib_stats(phy);
        }
@@ -1734,9 +1735,9 @@ void mt7915_mac_work(struct work_struct *work)
                mt7915_mac_sta_stats_work(phy);
        };
 
-       mutex_unlock(&mdev->mutex);
+       mutex_unlock(&mphy->dev->mutex);
 
-       ieee80211_queue_delayed_work(phy->mt76->hw, &phy->mac_work,
+       ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
                                     MT7915_WATCHDOG_TIME);
 }
 
index 3e0458fee937447d5b91827db158b0d26dc832e4..60a0fc9ec3c7b74a7940b61cd38d3c2db8fda963 100644 (file)
@@ -50,7 +50,7 @@ static int mt7915_start(struct ieee80211_hw *hw)
        set_bit(MT76_STATE_RUNNING, &phy->mt76->state);
 
        if (!mt76_testmode_enabled(phy->mt76))
-               ieee80211_queue_delayed_work(hw, &phy->mac_work,
+               ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work,
                                             MT7915_WATCHDOG_TIME);
 
        if (!running)
@@ -66,7 +66,7 @@ static void mt7915_stop(struct ieee80211_hw *hw)
        struct mt7915_dev *dev = mt7915_hw_dev(hw);
        struct mt7915_phy *phy = mt7915_hw_phy(hw);
 
-       cancel_delayed_work_sync(&phy->mac_work);
+       cancel_delayed_work_sync(&phy->mt76->mac_work);
 
        mutex_lock(&dev->mt76.mutex);
 
@@ -273,7 +273,7 @@ int mt7915_set_channel(struct mt7915_phy *phy)
        struct mt7915_dev *dev = phy->dev;
        int ret;
 
-       cancel_delayed_work_sync(&phy->mac_work);
+       cancel_delayed_work_sync(&phy->mt76->mac_work);
 
        mutex_lock(&dev->mt76.mutex);
        set_bit(MT76_RESET, &phy->mt76->state);
@@ -299,7 +299,8 @@ out:
        mt76_txq_schedule_all(phy->mt76);
 
        if (!mt76_testmode_enabled(phy->mt76))
-               ieee80211_queue_delayed_work(phy->mt76->hw, &phy->mac_work,
+               ieee80211_queue_delayed_work(phy->mt76->hw,
+                                            &phy->mt76->mac_work,
                                             MT7915_WATCHDOG_TIME);
 
        return ret;
index df7ac2cf052faf38934627a1e9f337d463acf5b5..a3cdaecef4cef7ca01242cbde40597a292d4ef53 100644 (file)
@@ -140,8 +140,6 @@ struct mt7915_phy {
        struct mib_stats mib;
        struct list_head stats_list;
 
-       struct delayed_work mac_work;
-       u8 mac_work_count;
        u8 sta_work_count;
 
 #ifdef CONFIG_NL80211_TESTMODE