#ifdef CONFIG_NL80211_TESTMODE
        struct mt76_testmode_data test;
 #endif
+
+       struct delayed_work mac_work;
+       u8 mac_work_count;
 };
 
 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;
 
        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;
 
 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;
 
 
        mutex_lock(&dev->mt76.mutex);
 
-       dev->mac_work_count++;
+       dev->mphy.mac_work_count++;
        mt76_update_survey(&dev->mt76);
        mt7603_edcca_check(dev);
 
                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,
                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));
 }
 
        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;
 }
        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);
 }
 
        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);
 
        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 */
        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;
 }
 
 
        spinlock_t ps_lock;
 
-       u8 mac_work_count;
-
        u8 mcu_running;
 
        u8 ed_monitor_enabled;
 
        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);
 
        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);
 
 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);
 
        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);
 }
 
        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);
        }
 
        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);
 
 }
 
 
        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)
        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);
 
        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);
 
        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;
 
        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,
                                            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);
 
 
        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;
 
 
        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);
 }
 
 
 
        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);
 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,
 
 
        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);
 
                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);
 
 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);
 
        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);
 }
 
 
        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;
 
 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);
 
        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);
 
 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);
 }
 
 
        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);
 
 
        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);
        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);
 
        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);
 
        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);
 }
 
 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);
        }
                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);
 }
 
 
        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)
        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);
 
        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);
        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;
 
        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