]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mt76: move state from struct mt76_dev to mt76_phy
authorFelix Fietkau <nbd@nbd.name>
Wed, 16 Oct 2019 10:09:22 +0000 (12:09 +0200)
committerFelix Fietkau <nbd@nbd.name>
Fri, 14 Feb 2020 09:03:08 +0000 (10:03 +0100)
Allows keeping per-wiphy state separate

Signed-off-by: Felix Fietkau <nbd@nbd.name>
34 files changed:
drivers/net/wireless/mediatek/mt76/mac80211.c
drivers/net/wireless/mediatek/mt76/mt76.h
drivers/net/wireless/mediatek/mt76/mt7603/core.c
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/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/mcu.c
drivers/net/wireless/mediatek/mt76/mt7615/pci.c
drivers/net/wireless/mediatek/mt76/mt76x0/main.c
drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
drivers/net/wireless/mediatek/mt76/mt76x0/pci_mcu.c
drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c
drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.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/pci_phy.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_mac.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c
drivers/net/wireless/mediatek/mt76/tx.c
drivers/net/wireless/mediatek/mt76/usb.c

index aa61ebcf86a06a97f67f34e33201720c62b1e21d..9d4b5acd555c8056c65d72b2ebb415d0328ca8a1 100644 (file)
@@ -403,7 +403,10 @@ EXPORT_SYMBOL_GPL(mt76_free_device);
 
 void mt76_rx(struct mt76_dev *dev, enum mt76_rxq_id q, struct sk_buff *skb)
 {
-       if (!test_bit(MT76_STATE_RUNNING, &dev->state)) {
+       struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb;
+       struct mt76_phy *phy = mt76_dev_phy(dev, status->ext_phy);
+
+       if (!test_bit(MT76_STATE_RUNNING, &phy->state)) {
                dev_kfree_skb(skb);
                return;
        }
@@ -459,9 +462,6 @@ void mt76_update_survey(struct mt76_dev *dev)
 {
        ktime_t cur_time;
 
-       if (!test_bit(MT76_STATE_RUNNING, &dev->state))
-               return;
-
        if (dev->drv->update_survey)
                dev->drv->update_survey(dev);
 
@@ -1063,17 +1063,17 @@ EXPORT_SYMBOL_GPL(mt76_get_rate);
 void mt76_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                  const u8 *mac)
 {
-       struct mt76_dev *dev = hw->priv;
+       struct mt76_phy *phy = hw->priv;
 
-       set_bit(MT76_SCANNING, &dev->state);
+       set_bit(MT76_SCANNING, &phy->state);
 }
 EXPORT_SYMBOL_GPL(mt76_sw_scan);
 
 void mt76_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
-       struct mt76_dev *dev = hw->priv;
+       struct mt76_phy *phy = hw->priv;
 
-       clear_bit(MT76_SCANNING, &dev->state);
+       clear_bit(MT76_SCANNING, &phy->state);
 }
 EXPORT_SYMBOL_GPL(mt76_sw_scan_complete);
 
index cf1c2b455205f8d7942e65bcbf8204bbe6000717..c6f78292b0997c953983f827bbf8f0019f14d001 100644 (file)
@@ -458,6 +458,8 @@ struct mt76_phy {
        struct ieee80211_hw *hw;
        struct mt76_dev *dev;
 
+       unsigned long state;
+
        struct cfg80211_chan_def chandef;
        struct ieee80211_channel *main_chan;
 
@@ -518,7 +520,6 @@ struct mt76_dev {
 
        u8 macaddr[ETH_ALEN];
        u32 rev;
-       unsigned long state;
 
        u32 aggr_stats[32];
 
@@ -660,12 +661,18 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str,
 int mt76_eeprom_init(struct mt76_dev *dev, int len);
 void mt76_eeprom_override(struct mt76_dev *dev);
 
+static inline struct mt76_phy *
+mt76_dev_phy(struct mt76_dev *dev, bool phy_ext)
+{
+       if (phy_ext && dev->phy2)
+               return dev->phy2;
+       return &dev->phy;
+}
+
 static inline struct ieee80211_hw *
 mt76_phy_hw(struct mt76_dev *dev, bool phy_ext)
 {
-       if (phy_ext && dev->phy2)
-               return dev->phy2->hw;
-       return dev->phy.hw;
+       return mt76_dev_phy(dev, phy_ext)->hw;
 }
 
 static inline u8 *
index e5af4f3389ccf048cc41cf4ba7814e05178b241c..693a91be070a3fcaa6be8c965e3c2069fb7531e8 100644 (file)
@@ -17,7 +17,7 @@ irqreturn_t mt7603_irq_handler(int irq, void *dev_instance)
        intr = mt76_rr(dev, MT_INT_SOURCE_CSR);
        mt76_wr(dev, MT_INT_SOURCE_CSR, intr);
 
-       if (!test_bit(MT76_STATE_INITIALIZED, &dev->mt76.state))
+       if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state))
                return IRQ_NONE;
 
        intr &= dev->mt76.mmio.irqmask;
index 4fb0cf8e4f751908849f5fed0469fd9fda0d21f9..2ca07dd4db4b4cc8fef5edb9aeb837522e9a341d 100644 (file)
@@ -284,7 +284,7 @@ mt7603_init_hardware(struct mt7603_dev *dev)
        mt76_wr(dev, MT_WPDMA_GLO_CFG, 0x52000850);
        mt7603_mac_dma_start(dev);
        dev->rxfilter = mt76_rr(dev, MT_WF_RFCR);
-       set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state);
+       set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
 
        for (i = 0; i < MT7603_WTBL_SIZE; i++) {
                mt76_wr(dev, MT_PSE_RTA, MT_PSE_RTA_BUSY | MT_PSE_RTA_WRITE |
index 588b21694ea3f599d8f8086290a4a3a358513e08..8a41bf118ed87b2d1f14ef76799d9506da501c3e 100644 (file)
@@ -1389,7 +1389,7 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev)
        int i;
 
        ieee80211_stop_queues(dev->mt76.hw);
-       set_bit(MT76_RESET, &dev->mt76.state);
+       set_bit(MT76_RESET, &dev->mphy.state);
 
        /* lock/unlock all queues to ensure that no tx is pending */
        mt76_txq_schedule_all(&dev->mphy);
@@ -1439,7 +1439,7 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev)
        mt7603_irq_enable(dev, mask);
 
 skip_dma_reset:
-       clear_bit(MT76_RESET, &dev->mt76.state);
+       clear_bit(MT76_RESET, &dev->mphy.state);
        mutex_unlock(&dev->mt76.mutex);
 
        tasklet_enable(&dev->mt76.tx_tasklet);
index 2df06487f7fdb391ad78b71f1136473bac9dcef5..6da7caaaade137cf78b56d654ba8059760dc315d 100644 (file)
@@ -16,7 +16,7 @@ mt7603_start(struct ieee80211_hw *hw)
        mt7603_mac_reset_counters(dev);
        mt7603_mac_start(dev);
        dev->mphy.survey_time = ktime_get_boottime();
-       set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
+       set_bit(MT76_STATE_RUNNING, &dev->mphy.state);
        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);
+       clear_bit(MT76_STATE_RUNNING, &dev->mphy.state);
        cancel_delayed_work_sync(&dev->mt76.mac_work);
        mt7603_mac_stop(dev);
 }
@@ -143,7 +143,7 @@ mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
        tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
 
        mutex_lock(&dev->mt76.mutex);
-       set_bit(MT76_RESET, &dev->mt76.state);
+       set_bit(MT76_RESET, &dev->mphy.state);
 
        mt7603_beacon_set_timer(dev, -1, 0);
        mt76_set_channel(&dev->mphy);
@@ -176,7 +176,7 @@ mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
        mt7603_mac_set_timing(dev);
        mt7603_mac_start(dev);
 
-       clear_bit(MT76_RESET, &dev->mt76.state);
+       clear_bit(MT76_RESET, &dev->mphy.state);
 
        mt76_txq_schedule_all(&dev->mphy);
 
index 5b12cb4d2765d0551069143a603169d259724b2e..e071cafe80e48a00e37229c03c4b04cdbb4c697c 100644 (file)
@@ -123,7 +123,7 @@ static int mt7615_init_hardware(struct mt7615_dev *dev)
        if (ret)
                return ret;
 
-       set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state);
+       set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
 
        ret = mt7615_mcu_init(dev);
        if (ret)
index 83a219d21d3a60d0aca4afb35970f24eb6f7bef3..727af49ca6663e2fb859c590d81b00cc969fad06 100644 (file)
@@ -72,7 +72,7 @@ int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb)
        bool unicast, remove_pad, insert_ccmp_hdr = false;
        int i, idx;
 
-       if (!test_bit(MT76_STATE_RUNNING, &dev->mt76.state))
+       if (!test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
                return -EINVAL;
 
        memset(status, 0, sizeof(*status));
@@ -1485,7 +1485,7 @@ int mt7615_dfs_init_radar_detector(struct mt7615_dev *dev)
        if (dev->mt76.region == NL80211_DFS_UNSET)
                return 0;
 
-       if (test_bit(MT76_SCANNING, &dev->mt76.state))
+       if (test_bit(MT76_SCANNING, &dev->mphy.state))
                return 0;
 
        if (dev->dfs_state == chandef->chan->dfs_state)
index 0f9fd859b597e1704a68735e163b2c6e0f33882a..cc5651a4441e26a679934c13291076f4312c4c87 100644 (file)
@@ -19,7 +19,7 @@ static int mt7615_start(struct ieee80211_hw *hw)
        mt7615_mac_reset_counters(dev);
 
        dev->mphy.survey_time = ktime_get_boottime();
-       set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
+       set_bit(MT76_STATE_RUNNING, &dev->mphy.state);
        ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
                                     MT7615_WATCHDOG_TIME);
 
@@ -30,7 +30,7 @@ static void mt7615_stop(struct ieee80211_hw *hw)
 {
        struct mt7615_dev *dev = hw->priv;
 
-       clear_bit(MT76_STATE_RUNNING, &dev->mt76.state);
+       clear_bit(MT76_STATE_RUNNING, &dev->mphy.state);
        cancel_delayed_work_sync(&dev->mt76.mac_work);
 }
 
@@ -151,7 +151,7 @@ static int mt7615_set_channel(struct mt7615_dev *dev)
        cancel_delayed_work_sync(&dev->mt76.mac_work);
 
        mutex_lock(&dev->mt76.mutex);
-       set_bit(MT76_RESET, &dev->mt76.state);
+       set_bit(MT76_RESET, &dev->mphy.state);
 
        mt7615_dfs_check_channel(dev);
 
@@ -168,7 +168,7 @@ static int mt7615_set_channel(struct mt7615_dev *dev)
        mt7615_mac_reset_counters(dev);
 
 out:
-       clear_bit(MT76_RESET, &dev->mt76.state);
+       clear_bit(MT76_RESET, &dev->mphy.state);
        mutex_unlock(&dev->mt76.mutex);
 
        mt76_txq_schedule_all(&dev->mphy);
index e6773d3bacfdcc3768e609fd2be3ba36a38090e9..1aba10e6b5cbe3f61b5432abaaf18c2357712eee 100644 (file)
@@ -104,7 +104,7 @@ static int __mt7615_mcu_msg_send(struct mt7615_dev *dev, struct sk_buff *skb,
        if (wait_seq)
                *wait_seq = seq;
 
-       if (test_bit(MT76_STATE_MCU_RUNNING, &dev->mt76.state))
+       if (test_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state))
                qid = MT_TXQ_MCU;
        else
                qid = MT_TXQ_FWDL;
@@ -561,7 +561,7 @@ int mt7615_mcu_init(struct mt7615_dev *dev)
        if (ret)
                return ret;
 
-       set_bit(MT76_STATE_MCU_RUNNING, &dev->mt76.state);
+       set_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state);
 
        return 0;
 }
index 1eb1eb659c3f0205454143f7e14b4193743e4ca1..dd9ee80dbef79c49f7dc52f430b4e3802d291e1d 100644 (file)
@@ -43,7 +43,7 @@ static irqreturn_t mt7615_irq_handler(int irq, void *dev_instance)
        intr = mt76_rr(dev, MT_INT_SOURCE_CSR);
        mt76_wr(dev, MT_INT_SOURCE_CSR, intr);
 
-       if (!test_bit(MT76_STATE_INITIALIZED, &dev->mt76.state))
+       if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state))
                return IRQ_NONE;
 
        intr &= dev->mt76.mmio.irqmask;
index c2383bb48cfdb59ada6219e251d3ea56c9e34428..50b3bba19ddb08cc472d1f1cc7f868e618c2bafe 100644 (file)
@@ -46,7 +46,7 @@ int mt76x0_config(struct ieee80211_hw *hw, u32 changed)
        if (changed & IEEE80211_CONF_CHANGE_POWER) {
                dev->mt76.txpower_conf = hw->conf.power_level * 2;
 
-               if (test_bit(MT76_STATE_RUNNING, &dev->mt76.state))
+               if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
                        mt76x0_phy_set_txpower(dev);
        }
 
index e2974e0ae1fce545409092fa3a36e0229893d7b0..88ff51400f8f2cb05a8f0042991d340161af228d 100644 (file)
@@ -20,7 +20,7 @@ static int mt76x0e_start(struct ieee80211_hw *hw)
                                     MT_MAC_WORK_INTERVAL);
        ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
                                     MT_CALIBRATE_INTERVAL);
-       set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
+       set_bit(MT76_STATE_RUNNING, &dev->mphy.state);
 
        return 0;
 }
@@ -47,7 +47,7 @@ static void mt76x0e_stop(struct ieee80211_hw *hw)
 {
        struct mt76x02_dev *dev = hw->priv;
 
-       clear_bit(MT76_STATE_RUNNING, &dev->mt76.state);
+       clear_bit(MT76_STATE_RUNNING, &dev->mphy.state);
        mt76x0e_stop_hw(dev);
 }
 
@@ -124,7 +124,7 @@ static int mt76x0e_register_device(struct mt76x02_dev *dev)
        if (err < 0)
                return err;
 
-       set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state);
+       set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
 
        return 0;
 }
@@ -195,7 +195,7 @@ error:
 
 static void mt76x0e_cleanup(struct mt76x02_dev *dev)
 {
-       clear_bit(MT76_STATE_INITIALIZED, &dev->mt76.state);
+       clear_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
        tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
        mt76x0_chip_onoff(dev, false, false);
        mt76x0e_stop_hw(dev);
index 038187b390ce550c6d6f53415cebeeaa4fbd04de..007c762c6db109bf0e3b36c00de7d20cd35e67ba 100644 (file)
@@ -126,7 +126,7 @@ int mt76x0e_mcu_init(struct mt76x02_dev *dev)
        if (err < 0)
                return err;
 
-       set_bit(MT76_STATE_MCU_RUNNING, &dev->mt76.state);
+       set_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state);
 
        return 0;
 }
index 2502faa296fd13dc72655dfdd6a68e9f83229627..9b1ae77b8fd2f201d14130b62aae7d10f0071e14 100644 (file)
@@ -23,7 +23,7 @@ mt76x0_rf_csr_wr(struct mt76x02_dev *dev, u32 offset, u8 value)
        int ret = 0;
        u8 bank, reg;
 
-       if (test_bit(MT76_REMOVED, &dev->mt76.state))
+       if (test_bit(MT76_REMOVED, &dev->mphy.state))
                return -ENODEV;
 
        bank = MT_RF_BANK(offset);
@@ -62,7 +62,7 @@ static int mt76x0_rf_csr_rr(struct mt76x02_dev *dev, u32 offset)
        u32 val;
        u8 bank, reg;
 
-       if (test_bit(MT76_REMOVED, &dev->mt76.state))
+       if (test_bit(MT76_REMOVED, &dev->mphy.state))
                return -ENODEV;
 
        bank = MT_RF_BANK(offset);
@@ -109,7 +109,7 @@ mt76x0_rf_wr(struct mt76x02_dev *dev, u32 offset, u8 val)
                };
 
                WARN_ON_ONCE(!test_bit(MT76_STATE_MCU_RUNNING,
-                                      &dev->mt76.state));
+                                      &dev->mphy.state));
                return mt76_wr_rp(dev, MT_MCU_MEMMAP_RF, &pair, 1);
        } else {
                return mt76x0_rf_csr_wr(dev, offset, val);
@@ -127,7 +127,7 @@ static int mt76x0_rf_rr(struct mt76x02_dev *dev, u32 offset)
                };
 
                WARN_ON_ONCE(!test_bit(MT76_STATE_MCU_RUNNING,
-                                      &dev->mt76.state));
+                                      &dev->mphy.state));
                ret = mt76_rd_rp(dev, MT_MCU_MEMMAP_RF, &pair, 1);
                val = pair.value;
        } else {
@@ -933,7 +933,7 @@ void mt76x0_phy_set_channel(struct mt76x02_dev *dev,
                      FIELD_PREP(MT_EXT_CCA_CFG_CCA3, 0) |
                      FIELD_PREP(MT_EXT_CCA_CFG_CCA_MASK, BIT(3)),
        };
-       bool scan = test_bit(MT76_SCANNING, &dev->mt76.state);
+       bool scan = test_bit(MT76_SCANNING, &dev->mphy.state);
        int ch_group_index, freq, freq1;
        u8 channel;
        u32 val;
index 65ba9fc6ea0be4f1e5a81a0d567dc56928c1fa5f..abf0a19ee70efb8fa714861d5b3762d36b686b95 100644 (file)
@@ -71,7 +71,7 @@ static void mt76x0_init_usb_dma(struct mt76x02_dev *dev)
 
 static void mt76x0u_cleanup(struct mt76x02_dev *dev)
 {
-       clear_bit(MT76_STATE_INITIALIZED, &dev->mt76.state);
+       clear_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
        mt76x0_chip_onoff(dev, false, false);
        mt76u_queues_deinit(&dev->mt76);
 }
@@ -80,13 +80,13 @@ static void mt76x0u_stop(struct ieee80211_hw *hw)
 {
        struct mt76x02_dev *dev = hw->priv;
 
-       clear_bit(MT76_STATE_RUNNING, &dev->mt76.state);
+       clear_bit(MT76_STATE_RUNNING, &dev->mphy.state);
        cancel_delayed_work_sync(&dev->cal_work);
        cancel_delayed_work_sync(&dev->mt76.mac_work);
        mt76u_stop_tx(&dev->mt76);
        mt76x02u_exit_beacon_config(dev);
 
-       if (test_bit(MT76_REMOVED, &dev->mt76.state))
+       if (test_bit(MT76_REMOVED, &dev->mphy.state))
                return;
 
        if (!mt76_poll(dev, MT_USB_DMA_CFG, MT_USB_DMA_CFG_TX_BUSY, 0, 1000))
@@ -112,7 +112,7 @@ static int mt76x0u_start(struct ieee80211_hw *hw)
                                     MT_MAC_WORK_INTERVAL);
        ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
                                     MT_CALIBRATE_INTERVAL);
-       set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
+       set_bit(MT76_STATE_RUNNING, &dev->mphy.state);
        return 0;
 }
 
@@ -192,7 +192,7 @@ static int mt76x0u_register_device(struct mt76x02_dev *dev)
        else
                hw->max_tx_fragments = 1;
 
-       set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state);
+       set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
 
        return 0;
 
@@ -283,7 +283,7 @@ err:
 static void mt76x0_disconnect(struct usb_interface *usb_intf)
 {
        struct mt76x02_dev *dev = usb_get_intfdata(usb_intf);
-       bool initialized = test_bit(MT76_STATE_INITIALIZED, &dev->mt76.state);
+       bool initialized = test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
 
        if (!initialized)
                return;
@@ -304,7 +304,7 @@ static int __maybe_unused mt76x0_suspend(struct usb_interface *usb_intf,
        struct mt76x02_dev *dev = usb_get_intfdata(usb_intf);
 
        mt76u_stop_rx(&dev->mt76);
-       clear_bit(MT76_STATE_MCU_RUNNING, &dev->mt76.state);
+       clear_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state);
        mt76x0_chip_onoff(dev, false, false);
 
        return 0;
index 888a930a5e083a04ac07c2372fb6448809ac677d..45502fd4693f34145f6e3fd491649dacd973ea02 100644 (file)
@@ -168,7 +168,7 @@ int mt76x0u_mcu_init(struct mt76x02_dev *dev)
        if (ret < 0)
                return ret;
 
-       set_bit(MT76_STATE_MCU_RUNNING, &dev->mt76.state);
+       set_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state);
 
        return 0;
 }
index f6cb2b6490a9de03e0e492458d737ac46e9da28c..ff6a9e4daac077777b11155ec09628a03c327f4e 100644 (file)
@@ -616,7 +616,7 @@ static void mt76x02_dfs_tasklet(unsigned long arg)
        u32 engine_mask;
        int i;
 
-       if (test_bit(MT76_SCANNING, &dev->mt76.state))
+       if (test_bit(MT76_SCANNING, &dev->mphy.state))
                goto out;
 
        if (time_is_before_jiffies(dfs_pd->last_sw_check +
index 965c93b6009b14c0ffeedd3db903063dada45f2a..8a4396941ef203daed9271f628e6720522d3792c 100644 (file)
@@ -775,7 +775,7 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb,
        u8 wcid;
        int len;
 
-       if (!test_bit(MT76_STATE_RUNNING, &dev->mt76.state))
+       if (!test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
                return -EINVAL;
 
        if (rxinfo & MT_RXINFO_L2PAD)
@@ -868,7 +868,7 @@ void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq)
        u8 update = 1;
        bool ret;
 
-       if (!test_bit(MT76_STATE_RUNNING, &dev->mt76.state))
+       if (!test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
                return;
 
        trace_mac_txstat_poll(dev);
index 7d946aa771820f5de36906e8b2f224eccb85bbd3..37445bc7b546b38d0aff043927a4f61ff90f0c6a 100644 (file)
@@ -152,7 +152,7 @@ static inline bool mt76x02_wait_for_mac(struct mt76_dev *dev)
        int i;
 
        for (i = 0; i < 500; i++) {
-               if (test_bit(MT76_REMOVED, &dev->state))
+               if (test_bit(MT76_REMOVED, &dev->phy.state))
                        return false;
 
                switch (dev->bus->rr(dev, MAC_CSR0)) {
index 7d463f7bc87f00ade22c3d1bf741e9e7b40e4512..e7ba9bf82d98df3fc8d2c49343c0502875a8cec3 100644 (file)
@@ -261,7 +261,7 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance)
        intr = mt76_rr(dev, MT_INT_SOURCE_CSR);
        mt76_wr(dev, MT_INT_SOURCE_CSR, intr);
 
-       if (!test_bit(MT76_STATE_INITIALIZED, &dev->mt76.state))
+       if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state))
                return IRQ_NONE;
 
        trace_dev_irq(dev, intr, dev->mt76.mmio.irqmask);
@@ -402,7 +402,7 @@ static void mt76x02_reset_state(struct mt76x02_dev *dev)
 
        lockdep_assert_held(&dev->mt76.mutex);
 
-       clear_bit(MT76_STATE_RUNNING, &dev->mt76.state);
+       clear_bit(MT76_STATE_RUNNING, &dev->mphy.state);
 
        rcu_read_lock();
        ieee80211_iter_keys_rcu(dev->mt76.hw, NULL, mt76x02_key_sync, NULL);
@@ -441,7 +441,7 @@ static void mt76x02_watchdog_reset(struct mt76x02_dev *dev)
        int i;
 
        ieee80211_stop_queues(dev->mt76.hw);
-       set_bit(MT76_RESET, &dev->mt76.state);
+       set_bit(MT76_RESET, &dev->mphy.state);
 
        tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
        tasklet_disable(&dev->mt76.tx_tasklet);
@@ -496,7 +496,7 @@ static void mt76x02_watchdog_reset(struct mt76x02_dev *dev)
 
        mutex_unlock(&dev->mt76.mutex);
 
-       clear_bit(MT76_RESET, &dev->mt76.state);
+       clear_bit(MT76_RESET, &dev->mphy.state);
 
        tasklet_enable(&dev->mt76.tx_tasklet);
        napi_enable(&dev->mt76.tx_napi);
index d03d3c8e296c758125f9f11d06ff0fdab669f56d..5cf015c1ef5d37564757fbe86c02b6233ac77963 100644 (file)
@@ -280,7 +280,7 @@ EXPORT_SYMBOL_GPL(mt76x02u_init_beacon_config);
 
 void mt76x02u_exit_beacon_config(struct mt76x02_dev *dev)
 {
-       if (!test_bit(MT76_REMOVED, &dev->mt76.state))
+       if (!test_bit(MT76_REMOVED, &dev->mphy.state))
                mt76_clear(dev, MT_BEACON_TIME_CFG,
                           MT_BEACON_TIME_CFG_TIMER_EN |
                           MT_BEACON_TIME_CFG_SYNC_MODE |
index a993cd7e9948f114589d015dcc337ca075e969b0..106ff4b3e6ff0f7c9374c37a7c3c3dfad975bc5b 100644 (file)
@@ -87,7 +87,7 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
        u8 seq = 0;
        u32 info;
 
-       if (test_bit(MT76_REMOVED, &dev->state))
+       if (test_bit(MT76_REMOVED, &dev->phy.state))
                return 0;
 
        if (wait_resp) {
index 837ba7f01f317c649d075ae346784c9996df600b..d226112494d398b0efe7b7493fe1f597ad5e3a08 100644 (file)
@@ -602,7 +602,7 @@ void mt76x02_sw_scan_complete(struct ieee80211_hw *hw,
 {
        struct mt76x02_dev *dev = hw->priv;
 
-       clear_bit(MT76_SCANNING, &dev->mt76.state);
+       clear_bit(MT76_SCANNING, &dev->mphy.state);
        if (dev->cal.gain_init_done) {
                /* Restore AGC gain and resume calibration after scanning. */
                dev->cal.low_gain = -1;
index bae05a088b5e71d98bcbe901ff5d32c318b8484e..c69579e5f6479044014cc3ed7c4fd3788465564e 100644 (file)
@@ -239,7 +239,7 @@ static int mt76x2_init_hardware(struct mt76x02_dev *dev)
        if (ret)
                return ret;
 
-       set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state);
+       set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
        mt76x02_mac_start(dev);
 
        ret = mt76x2_mcu_init(dev);
index 8c639cbc99ed6211b51d007b8cfd4a05c89c0595..1f2db374ed51d8dadbcf352cdc01c19675534d49 100644 (file)
@@ -22,7 +22,7 @@ mt76x2_start(struct ieee80211_hw *hw)
        ieee80211_queue_delayed_work(mt76_hw(dev), &dev->wdt_work,
                                     MT_WATCHDOG_TIME);
 
-       set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
+       set_bit(MT76_STATE_RUNNING, &dev->mphy.state);
        return 0;
 }
 
@@ -31,7 +31,7 @@ mt76x2_stop(struct ieee80211_hw *hw)
 {
        struct mt76x02_dev *dev = hw->priv;
 
-       clear_bit(MT76_STATE_RUNNING, &dev->mt76.state);
+       clear_bit(MT76_STATE_RUNNING, &dev->mphy.state);
        mt76x2_stop_hardware(dev);
 }
 
@@ -45,7 +45,7 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
        tasklet_disable(&dev->dfs_pd.dfs_tasklet);
 
        mutex_lock(&dev->mt76.mutex);
-       set_bit(MT76_RESET, &dev->mt76.state);
+       set_bit(MT76_RESET, &dev->mphy.state);
 
        mt76_set_channel(&dev->mphy);
 
@@ -57,7 +57,7 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
 
        mt76x2_mac_resume(dev);
 
-       clear_bit(MT76_RESET, &dev->mt76.state);
+       clear_bit(MT76_RESET, &dev->mphy.state);
        mutex_unlock(&dev->mt76.mutex);
 
        tasklet_enable(&dev->dfs_pd.dfs_tasklet);
@@ -91,7 +91,7 @@ mt76x2_config(struct ieee80211_hw *hw, u32 changed)
                /* convert to per-chain power for 2x2 devices */
                dev->mt76.txpower_conf -= 6;
 
-               if (test_bit(MT76_STATE_RUNNING, &dev->mt76.state)) {
+               if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state)) {
                        mt76x2_phy_set_txpower(dev);
                        mt76x02_tx_set_txpwr_auto(dev, dev->mt76.txpower_conf);
                }
index 83d00bf7421832db935125f34525eec203497862..e996b736a690bedd3acddf44266ef708ada0263b 100644 (file)
@@ -118,7 +118,7 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev,
                           struct cfg80211_chan_def *chandef)
 {
        struct ieee80211_channel *chan = chandef->chan;
-       bool scan = test_bit(MT76_SCANNING, &dev->mt76.state);
+       bool scan = test_bit(MT76_SCANNING, &dev->mphy.state);
        enum nl80211_band band = chan->band;
        u8 channel;
 
index b64ad816cc25bbbec4413b1d8d8a384253dbc200..2c07063eadfed7aa35a1e9e664c73aa21df19e33 100644 (file)
@@ -86,7 +86,7 @@ static void mt76x2u_disconnect(struct usb_interface *intf)
        struct mt76x02_dev *dev = usb_get_intfdata(intf);
        struct ieee80211_hw *hw = mt76_hw(dev);
 
-       set_bit(MT76_REMOVED, &dev->mt76.state);
+       set_bit(MT76_REMOVED, &dev->mphy.state);
        ieee80211_unregister_hw(hw);
        mt76x2u_cleanup(dev);
        mt76u_deinit(&dev->mt76);
index 89b04da23db9949d6d9ad57e3894b5b8e0edd076..62e5e89baf2346cf0d9da1ea743f03ad7e410d85 100644 (file)
@@ -218,7 +218,7 @@ int mt76x2u_register_device(struct mt76x02_dev *dev)
        else
                hw->max_tx_fragments = 1;
 
-       set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state);
+       set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
 
        mt76x02_init_debugfs(dev);
        mt76x2_init_txpower(dev, &dev->mphy.sband_2g.sband);
index 59cbe826188a7db164464da4fb2558d61364b519..eaa622833f85902a13f9c0046506aa993bcad127 100644 (file)
@@ -98,7 +98,7 @@ int mt76x2u_mac_stop(struct mt76x02_dev *dev)
        bool stopped = false;
        u32 rts_cfg;
 
-       if (test_bit(MT76_REMOVED, &dev->mt76.state))
+       if (test_bit(MT76_REMOVED, &dev->mphy.state))
                return -EIO;
 
        rts_cfg = mt76_rr(dev, MT_TX_RTS_CFG);
index 24f2caf7bb66ab37ac44e74cc8a9362fc88e0d37..e51b9d38221be8437ccdffe2dffcdbba279851a5 100644 (file)
@@ -17,7 +17,7 @@ static int mt76x2u_start(struct ieee80211_hw *hw)
 
        ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
                                     MT_MAC_WORK_INTERVAL);
-       set_bit(MT76_STATE_RUNNING, &dev->mt76.state);
+       set_bit(MT76_STATE_RUNNING, &dev->mphy.state);
 
        return 0;
 }
@@ -26,7 +26,7 @@ static void mt76x2u_stop(struct ieee80211_hw *hw)
 {
        struct mt76x02_dev *dev = hw->priv;
 
-       clear_bit(MT76_STATE_RUNNING, &dev->mt76.state);
+       clear_bit(MT76_STATE_RUNNING, &dev->mphy.state);
        mt76u_stop_tx(&dev->mt76);
        mt76x2u_stop_hw(dev);
 }
@@ -41,7 +41,7 @@ mt76x2u_set_channel(struct mt76x02_dev *dev,
        mt76x02_pre_tbtt_enable(dev, false);
 
        mutex_lock(&dev->mt76.mutex);
-       set_bit(MT76_RESET, &dev->mt76.state);
+       set_bit(MT76_RESET, &dev->mphy.state);
 
        mt76_set_channel(&dev->mphy);
 
@@ -52,7 +52,7 @@ mt76x2u_set_channel(struct mt76x02_dev *dev,
        mt76x02_mac_cc_reset(dev);
        mt76x2_mac_resume(dev);
 
-       clear_bit(MT76_RESET, &dev->mt76.state);
+       clear_bit(MT76_RESET, &dev->mphy.state);
        mutex_unlock(&dev->mt76.mutex);
 
        mt76x02_pre_tbtt_enable(dev, true);
@@ -83,7 +83,7 @@ mt76x2u_config(struct ieee80211_hw *hw, u32 changed)
                /* convert to per-chain power for 2x2 devices */
                dev->mt76.txpower_conf -= 6;
 
-               if (test_bit(MT76_STATE_RUNNING, &dev->mt76.state))
+               if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
                        mt76x2_phy_set_txpower(dev);
        }
 
index d4d9b40ba8d91f6d7eedac27cbe14095528c143f..a04a98f5ce1ec4f36214b6872a2bab260fae848f 100644 (file)
@@ -82,7 +82,7 @@ int mt76x2u_phy_set_channel(struct mt76x02_dev *dev,
                      FIELD_PREP(MT_EXT_CCA_CFG_CCA3, 0) |
                      FIELD_PREP(MT_EXT_CCA_CFG_CCA_MASK, BIT(3)),
        };
-       bool scan = test_bit(MT76_SCANNING, &dev->mt76.state);
+       bool scan = test_bit(MT76_SCANNING, &dev->mphy.state);
        struct ieee80211_channel *chan = chandef->chan;
        u8 channel = chan->hw_value, bw, bw_index;
        int ch_group_index, freq, freq1, ret;
index c993ad7ef2e3c555aeebafedd85c143fec8aaa73..eff522dbda344ac564999c5b87867411f9ed2547 100644 (file)
@@ -442,7 +442,7 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_sw_queue *sq,
                if (probe)
                        break;
 
-               if (test_bit(MT76_RESET, &dev->state))
+               if (test_bit(MT76_RESET, &phy->state))
                        return -EBUSY;
 
                skb = mt76_txq_dequeue(phy, mtxq, false);
@@ -498,7 +498,7 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid)
                if (sq->swq_queued >= 4)
                        break;
 
-               if (test_bit(MT76_RESET, &dev->state)) {
+               if (test_bit(MT76_RESET, &phy->state)) {
                        ret = -EBUSY;
                        break;
                }
@@ -604,7 +604,7 @@ void mt76_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
        struct mt76_phy *phy = hw->priv;
        struct mt76_dev *dev = phy->dev;
 
-       if (!test_bit(MT76_STATE_RUNNING, &dev->state))
+       if (!test_bit(MT76_STATE_RUNNING, &phy->state))
                return;
 
        tasklet_schedule(&dev->tx_tasklet);
index 3478cff9ab9a32b5b67580415a28084b4229b809..8561d1bd7e6a80e7f3d8b46e937f22d5c4f9bf3a 100644 (file)
@@ -29,13 +29,13 @@ static int __mt76u_vendor_request(struct mt76_dev *dev, u8 req,
        pipe = (req_type & USB_DIR_IN) ? usb_rcvctrlpipe(udev, 0)
                                       : usb_sndctrlpipe(udev, 0);
        for (i = 0; i < MT_VEND_REQ_MAX_RETRY; i++) {
-               if (test_bit(MT76_REMOVED, &dev->state))
+               if (test_bit(MT76_REMOVED, &dev->phy.state))
                        return -EIO;
 
                ret = usb_control_msg(udev, pipe, req, req_type, val,
                                      offset, buf, len, MT_VEND_REQ_TOUT_MS);
                if (ret == -ENODEV)
-                       set_bit(MT76_REMOVED, &dev->state);
+                       set_bit(MT76_REMOVED, &dev->phy.state);
                if (ret >= 0 || ret == -ENODEV)
                        return ret;
                usleep_range(5000, 10000);
@@ -200,7 +200,7 @@ static int
 mt76u_wr_rp(struct mt76_dev *dev, u32 base,
            const struct mt76_reg_pair *data, int n)
 {
-       if (test_bit(MT76_STATE_MCU_RUNNING, &dev->state))
+       if (test_bit(MT76_STATE_MCU_RUNNING, &dev->phy.state))
                return dev->mcu_ops->mcu_wr_rp(dev, base, data, n);
        else
                return mt76u_req_wr_rp(dev, base, data, n);
@@ -227,7 +227,7 @@ static int
 mt76u_rd_rp(struct mt76_dev *dev, u32 base,
            struct mt76_reg_pair *data, int n)
 {
-       if (test_bit(MT76_STATE_MCU_RUNNING, &dev->state))
+       if (test_bit(MT76_STATE_MCU_RUNNING, &dev->phy.state))
                return dev->mcu_ops->mcu_rd_rp(dev, base, data, n);
        else
                return mt76u_req_rd_rp(dev, base, data, n);
@@ -464,7 +464,7 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb)
        int len, nsgs = 1;
        struct sk_buff *skb;
 
-       if (!test_bit(MT76_STATE_INITIALIZED, &dev->state))
+       if (!test_bit(MT76_STATE_INITIALIZED, &dev->phy.state))
                return 0;
 
        len = mt76u_get_rx_entry_len(data, urb->actual_length);
@@ -696,7 +696,7 @@ static void mt76u_tx_tasklet(unsigned long data)
 
                mt76_txq_schedule(&dev->phy, i);
 
-               if (!test_and_set_bit(MT76_READING_STATS, &dev->state))
+               if (!test_and_set_bit(MT76_READING_STATS, &dev->phy.state))
                        queue_work(dev->usb.stat_wq, &dev->usb.stat_work);
                if (wake)
                        ieee80211_wake_queue(dev->hw, i);
@@ -714,7 +714,7 @@ static void mt76u_tx_status_data(struct work_struct *work)
        dev = container_of(usb, struct mt76_dev, usb);
 
        while (true) {
-               if (test_bit(MT76_REMOVED, &dev->state))
+               if (test_bit(MT76_REMOVED, &dev->phy.state))
                        break;
 
                if (!dev->drv->tx_status_data(dev, &update))
@@ -722,10 +722,10 @@ static void mt76u_tx_status_data(struct work_struct *work)
                count++;
        }
 
-       if (count && test_bit(MT76_STATE_RUNNING, &dev->state))
+       if (count && test_bit(MT76_STATE_RUNNING, &dev->phy.state))
                queue_work(usb->stat_wq, &usb->stat_work);
        else
-               clear_bit(MT76_READING_STATS, &dev->state);
+               clear_bit(MT76_READING_STATS, &dev->phy.state);
 }
 
 static void mt76u_complete_tx(struct urb *urb)
@@ -806,7 +806,7 @@ static void mt76u_tx_kick(struct mt76_dev *dev, struct mt76_queue *q)
                err = usb_submit_urb(urb, GFP_ATOMIC);
                if (err < 0) {
                        if (err == -ENODEV)
-                               set_bit(MT76_REMOVED, &dev->state);
+                               set_bit(MT76_REMOVED, &dev->phy.state);
                        else
                                dev_err(dev->dev, "tx urb submit failed:%d\n",
                                        err);
@@ -905,7 +905,7 @@ void mt76u_stop_tx(struct mt76_dev *dev)
        }
 
        cancel_work_sync(&dev->usb.stat_work);
-       clear_bit(MT76_READING_STATS, &dev->state);
+       clear_bit(MT76_READING_STATS, &dev->phy.state);
 
        mt76_tx_status_check(dev, NULL, true);
 }