mt76: move mac_work in mt76_dev
authorLorenzo Bianconi <lorenzo@kernel.org>
Mon, 18 Mar 2019 10:21:44 +0000 (11:21 +0100)
committerFelix Fietkau <nbd@nbd.name>
Wed, 1 May 2019 11:03:58 +0000 (13:03 +0200)
Move mac_work delayed work in mt76_dev data structure since
it is used by all drivers and it will be reused adding mac work to
mt7615

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
14 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/mt76x0/pci.c
drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
drivers/net/wireless/mediatek/mt76/mt76x02.h
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

index c35305a..21c24a3 100644 (file)
@@ -448,6 +448,7 @@ struct mt76_dev {
        int tx_dma_idx[4];
 
        struct tasklet_struct tx_tasklet;
+       struct delayed_work mac_work;
 
        wait_queue_head_t tx_wait;
        struct sk_buff_head status_list;
index 9f50329..d394839 100644 (file)
@@ -513,7 +513,7 @@ int mt7603_register_device(struct mt7603_dev *dev)
 
        spin_lock_init(&dev->ps_lock);
 
-       INIT_DELAYED_WORK(&dev->mac_work, mt7603_mac_work);
+       INIT_DELAYED_WORK(&dev->mt76.mac_work, mt7603_mac_work);
        tasklet_init(&dev->pre_tbtt_tasklet, mt7603_pre_tbtt_tasklet,
                     (unsigned long)dev);
 
index 52956bf..4511e69 100644 (file)
@@ -1667,7 +1667,7 @@ out:
 void mt7603_mac_work(struct work_struct *work)
 {
        struct mt7603_dev *dev = container_of(work, struct mt7603_dev,
-                                             mac_work.work);
+                                             mt76.mac_work.work);
        bool reset = false;
 
        mt76_tx_status_check(&dev->mt76, NULL, false);
@@ -1720,6 +1720,6 @@ void mt7603_mac_work(struct work_struct *work)
        if (reset)
                mt7603_mac_watchdog_reset(dev);
 
-       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
+       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
                                     msecs_to_jiffies(MT7603_WATCHDOG_TIME));
 }
index 44745db..18db78a 100644 (file)
@@ -16,7 +16,7 @@ mt7603_start(struct ieee80211_hw *hw)
        mt7603_mac_start(dev);
        dev->survey_time = ktime_get_boottime();
        set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
-       mt7603_mac_work(&dev->mac_work.work);
+       mt7603_mac_work(&dev->mt76.mac_work.work);
 
        return 0;
 }
@@ -27,7 +27,7 @@ mt7603_stop(struct ieee80211_hw *hw)
        struct mt7603_dev *dev = hw->priv;
 
        clear_bit(MT76_STATE_RUNNING, &dev->mt76.state);
-       cancel_delayed_work_sync(&dev->mac_work);
+       cancel_delayed_work_sync(&dev->mt76.mac_work);
        mt7603_mac_stop(dev);
 }
 
@@ -132,7 +132,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->mac_work);
+       cancel_delayed_work_sync(&dev->mt76.mac_work);
 
        mutex_lock(&dev->mt76.mutex);
        set_bit(MT76_RESET, &dev->mt76.state);
@@ -171,7 +171,7 @@ mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
 
        mt76_txq_schedule_all(&dev->mt76);
 
-       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
+       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
                                     MT7603_WATCHDOG_TIME);
 
        /* reset channel stats */
@@ -189,7 +189,7 @@ out:
        mutex_unlock(&dev->mt76.mutex);
 
        if (failed)
-               mt7603_mac_work(&dev->mac_work.work);
+               mt7603_mac_work(&dev->mt76.mac_work.work);
 
        return ret;
 }
index 36875ff..488b19c 100644 (file)
@@ -144,7 +144,6 @@ struct mt7603_dev {
 
        unsigned int reset_cause[__RESET_CAUSE_MAX];
 
-       struct delayed_work mac_work;
        struct tasklet_struct pre_tbtt_tasklet;
 };
 
index 156d3d0..f106dbf 100644 (file)
@@ -29,7 +29,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->mac_work,
+       ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mt76.mac_work,
                                     MT_MAC_WORK_INTERVAL);
        ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
                                     MT_CALIBRATE_INTERVAL);
@@ -43,7 +43,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->mac_work);
+       cancel_delayed_work_sync(&dev->mt76.mac_work);
 
        if (!mt76_poll(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_TX_DMA_BUSY,
                       0, 1000))
index db2c3c6..ee8d4b5 100644 (file)
@@ -85,7 +85,7 @@ static void mt76x0u_mac_stop(struct mt76x02_dev *dev)
 {
        clear_bit(MT76_STATE_RUNNING, &dev->mt76.state);
        cancel_delayed_work_sync(&dev->cal_work);
-       cancel_delayed_work_sync(&dev->mac_work);
+       cancel_delayed_work_sync(&dev->mt76.mac_work);
        mt76u_stop_stat_wk(&dev->mt76);
        mt76x02u_exit_beacon_config(dev);
 
@@ -113,7 +113,7 @@ static int mt76x0u_start(struct ieee80211_hw *hw)
                goto out;
 
        mt76x0_phy_calibrate(dev, true);
-       ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mac_work,
+       ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mt76.mac_work,
                                     MT_MAC_WORK_INTERVAL);
        ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
                                     MT_CALIBRATE_INTERVAL);
index 0d817a1..3e51ce2 100644 (file)
@@ -92,7 +92,6 @@ struct mt76x02_dev {
        struct tasklet_struct tx_tasklet;
        struct tasklet_struct pre_tbtt_tasklet;
        struct delayed_work cal_work;
-       struct delayed_work mac_work;
        struct delayed_work wdt_work;
 
        struct hrtimer pre_tbtt_timer;
index b81b71b..bb6dbf7 100644 (file)
@@ -1029,7 +1029,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,
-                                              mac_work.work);
+                                              mt76.mac_work.work);
        int i, idx;
 
        mutex_lock(&dev->mt76.mutex);
@@ -1052,7 +1052,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->mac_work,
+       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
                                     MT_MAC_WORK_INTERVAL);
 }
 
index f3558c1..37af727 100644 (file)
@@ -132,7 +132,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->mac_work, mt76x02_mac_work);
+       INIT_DELAYED_WORK(&dev->mt76.mac_work, mt76x02_mac_work);
 
        hw->queues = 4;
        hw->max_rates = 1;
index 9e88a8c..90c1a04 100644 (file)
@@ -291,7 +291,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->mac_work);
+       cancel_delayed_work_sync(&dev->mt76.mac_work);
        cancel_delayed_work_sync(&dev->wdt_work);
        mt76x02_mcu_set_radio_state(dev, false);
        mt76x2_mac_stop(dev, false);
index 16dc8e2..77f63cb 100644 (file)
@@ -32,7 +32,7 @@ mt76x2_start(struct ieee80211_hw *hw)
        if (ret)
                goto out;
 
-       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
+       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
                                     MT_MAC_WORK_INTERVAL);
        ieee80211_queue_delayed_work(mt76_hw(dev), &dev->wdt_work,
                                     MT_WATCHDOG_TIME);
index 35bdf5f..96ee596 100644 (file)
@@ -246,7 +246,7 @@ void mt76x2u_stop_hw(struct mt76x02_dev *dev)
 {
        mt76u_stop_stat_wk(&dev->mt76);
        cancel_delayed_work_sync(&dev->cal_work);
-       cancel_delayed_work_sync(&dev->mac_work);
+       cancel_delayed_work_sync(&dev->mt76.mac_work);
        mt76x2u_mac_stop(dev);
 }
 
index eb414fb..dcf67f4 100644 (file)
@@ -27,7 +27,7 @@ static int mt76x2u_start(struct ieee80211_hw *hw)
        if (ret)
                goto out;
 
-       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
+       ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
                                     MT_MAC_WORK_INTERVAL);
        set_bit(MT76_STATE_RUNNING, &dev->mt76.state);