Commit 011849e0 authored by Felix Fietkau's avatar Felix Fietkau

mt76: move state from struct mt76_dev to mt76_phy

Allows keeping per-wiphy state separate
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 5a95ca41
...@@ -403,7 +403,10 @@ EXPORT_SYMBOL_GPL(mt76_free_device); ...@@ -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) 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); dev_kfree_skb(skb);
return; return;
} }
...@@ -459,9 +462,6 @@ void mt76_update_survey(struct mt76_dev *dev) ...@@ -459,9 +462,6 @@ void mt76_update_survey(struct mt76_dev *dev)
{ {
ktime_t cur_time; ktime_t cur_time;
if (!test_bit(MT76_STATE_RUNNING, &dev->state))
return;
if (dev->drv->update_survey) if (dev->drv->update_survey)
dev->drv->update_survey(dev); dev->drv->update_survey(dev);
...@@ -1063,17 +1063,17 @@ EXPORT_SYMBOL_GPL(mt76_get_rate); ...@@ -1063,17 +1063,17 @@ EXPORT_SYMBOL_GPL(mt76_get_rate);
void mt76_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, void mt76_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
const u8 *mac) 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); EXPORT_SYMBOL_GPL(mt76_sw_scan);
void mt76_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 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); EXPORT_SYMBOL_GPL(mt76_sw_scan_complete);
......
...@@ -458,6 +458,8 @@ struct mt76_phy { ...@@ -458,6 +458,8 @@ struct mt76_phy {
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
struct mt76_dev *dev; struct mt76_dev *dev;
unsigned long state;
struct cfg80211_chan_def chandef; struct cfg80211_chan_def chandef;
struct ieee80211_channel *main_chan; struct ieee80211_channel *main_chan;
...@@ -518,7 +520,6 @@ struct mt76_dev { ...@@ -518,7 +520,6 @@ struct mt76_dev {
u8 macaddr[ETH_ALEN]; u8 macaddr[ETH_ALEN];
u32 rev; u32 rev;
unsigned long state;
u32 aggr_stats[32]; u32 aggr_stats[32];
...@@ -660,12 +661,18 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str, ...@@ -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); int mt76_eeprom_init(struct mt76_dev *dev, int len);
void mt76_eeprom_override(struct mt76_dev *dev); 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 * static inline struct ieee80211_hw *
mt76_phy_hw(struct mt76_dev *dev, bool phy_ext) mt76_phy_hw(struct mt76_dev *dev, bool phy_ext)
{ {
if (phy_ext && dev->phy2) return mt76_dev_phy(dev, phy_ext)->hw;
return dev->phy2->hw;
return dev->phy.hw;
} }
static inline u8 * static inline u8 *
......
...@@ -17,7 +17,7 @@ irqreturn_t mt7603_irq_handler(int irq, void *dev_instance) ...@@ -17,7 +17,7 @@ irqreturn_t mt7603_irq_handler(int irq, void *dev_instance)
intr = mt76_rr(dev, MT_INT_SOURCE_CSR); intr = mt76_rr(dev, MT_INT_SOURCE_CSR);
mt76_wr(dev, MT_INT_SOURCE_CSR, intr); 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; return IRQ_NONE;
intr &= dev->mt76.mmio.irqmask; intr &= dev->mt76.mmio.irqmask;
......
...@@ -284,7 +284,7 @@ mt7603_init_hardware(struct mt7603_dev *dev) ...@@ -284,7 +284,7 @@ mt7603_init_hardware(struct mt7603_dev *dev)
mt76_wr(dev, MT_WPDMA_GLO_CFG, 0x52000850); mt76_wr(dev, MT_WPDMA_GLO_CFG, 0x52000850);
mt7603_mac_dma_start(dev); mt7603_mac_dma_start(dev);
dev->rxfilter = mt76_rr(dev, MT_WF_RFCR); 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++) { for (i = 0; i < MT7603_WTBL_SIZE; i++) {
mt76_wr(dev, MT_PSE_RTA, MT_PSE_RTA_BUSY | MT_PSE_RTA_WRITE | mt76_wr(dev, MT_PSE_RTA, MT_PSE_RTA_BUSY | MT_PSE_RTA_WRITE |
......
...@@ -1389,7 +1389,7 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev) ...@@ -1389,7 +1389,7 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev)
int i; int i;
ieee80211_stop_queues(dev->mt76.hw); 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 */ /* lock/unlock all queues to ensure that no tx is pending */
mt76_txq_schedule_all(&dev->mphy); mt76_txq_schedule_all(&dev->mphy);
...@@ -1439,7 +1439,7 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev) ...@@ -1439,7 +1439,7 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev)
mt7603_irq_enable(dev, mask); mt7603_irq_enable(dev, mask);
skip_dma_reset: skip_dma_reset:
clear_bit(MT76_RESET, &dev->mt76.state); clear_bit(MT76_RESET, &dev->mphy.state);
mutex_unlock(&dev->mt76.mutex); mutex_unlock(&dev->mt76.mutex);
tasklet_enable(&dev->mt76.tx_tasklet); tasklet_enable(&dev->mt76.tx_tasklet);
......
...@@ -16,7 +16,7 @@ mt7603_start(struct ieee80211_hw *hw) ...@@ -16,7 +16,7 @@ mt7603_start(struct ieee80211_hw *hw)
mt7603_mac_reset_counters(dev); mt7603_mac_reset_counters(dev);
mt7603_mac_start(dev); mt7603_mac_start(dev);
dev->mphy.survey_time = ktime_get_boottime(); 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); mt7603_mac_work(&dev->mt76.mac_work.work);
return 0; return 0;
...@@ -27,7 +27,7 @@ mt7603_stop(struct ieee80211_hw *hw) ...@@ -27,7 +27,7 @@ mt7603_stop(struct ieee80211_hw *hw)
{ {
struct mt7603_dev *dev = hw->priv; 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); cancel_delayed_work_sync(&dev->mt76.mac_work);
mt7603_mac_stop(dev); mt7603_mac_stop(dev);
} }
...@@ -143,7 +143,7 @@ mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def) ...@@ -143,7 +143,7 @@ mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
tasklet_disable(&dev->mt76.pre_tbtt_tasklet); tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
mutex_lock(&dev->mt76.mutex); 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); mt7603_beacon_set_timer(dev, -1, 0);
mt76_set_channel(&dev->mphy); mt76_set_channel(&dev->mphy);
...@@ -176,7 +176,7 @@ mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def) ...@@ -176,7 +176,7 @@ mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
mt7603_mac_set_timing(dev); mt7603_mac_set_timing(dev);
mt7603_mac_start(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); mt76_txq_schedule_all(&dev->mphy);
......
...@@ -123,7 +123,7 @@ static int mt7615_init_hardware(struct mt7615_dev *dev) ...@@ -123,7 +123,7 @@ static int mt7615_init_hardware(struct mt7615_dev *dev)
if (ret) if (ret)
return ret; return ret;
set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state); set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
ret = mt7615_mcu_init(dev); ret = mt7615_mcu_init(dev);
if (ret) if (ret)
......
...@@ -72,7 +72,7 @@ int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb) ...@@ -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; bool unicast, remove_pad, insert_ccmp_hdr = false;
int i, idx; int i, idx;
if (!test_bit(MT76_STATE_RUNNING, &dev->mt76.state)) if (!test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
return -EINVAL; return -EINVAL;
memset(status, 0, sizeof(*status)); memset(status, 0, sizeof(*status));
...@@ -1485,7 +1485,7 @@ int mt7615_dfs_init_radar_detector(struct mt7615_dev *dev) ...@@ -1485,7 +1485,7 @@ int mt7615_dfs_init_radar_detector(struct mt7615_dev *dev)
if (dev->mt76.region == NL80211_DFS_UNSET) if (dev->mt76.region == NL80211_DFS_UNSET)
return 0; return 0;
if (test_bit(MT76_SCANNING, &dev->mt76.state)) if (test_bit(MT76_SCANNING, &dev->mphy.state))
return 0; return 0;
if (dev->dfs_state == chandef->chan->dfs_state) if (dev->dfs_state == chandef->chan->dfs_state)
......
...@@ -19,7 +19,7 @@ static int mt7615_start(struct ieee80211_hw *hw) ...@@ -19,7 +19,7 @@ static int mt7615_start(struct ieee80211_hw *hw)
mt7615_mac_reset_counters(dev); mt7615_mac_reset_counters(dev);
dev->mphy.survey_time = ktime_get_boottime(); 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, ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
MT7615_WATCHDOG_TIME); MT7615_WATCHDOG_TIME);
...@@ -30,7 +30,7 @@ static void mt7615_stop(struct ieee80211_hw *hw) ...@@ -30,7 +30,7 @@ static void mt7615_stop(struct ieee80211_hw *hw)
{ {
struct mt7615_dev *dev = hw->priv; 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); cancel_delayed_work_sync(&dev->mt76.mac_work);
} }
...@@ -151,7 +151,7 @@ static int mt7615_set_channel(struct mt7615_dev *dev) ...@@ -151,7 +151,7 @@ static int mt7615_set_channel(struct mt7615_dev *dev)
cancel_delayed_work_sync(&dev->mt76.mac_work); cancel_delayed_work_sync(&dev->mt76.mac_work);
mutex_lock(&dev->mt76.mutex); mutex_lock(&dev->mt76.mutex);
set_bit(MT76_RESET, &dev->mt76.state); set_bit(MT76_RESET, &dev->mphy.state);
mt7615_dfs_check_channel(dev); mt7615_dfs_check_channel(dev);
...@@ -168,7 +168,7 @@ static int mt7615_set_channel(struct mt7615_dev *dev) ...@@ -168,7 +168,7 @@ static int mt7615_set_channel(struct mt7615_dev *dev)
mt7615_mac_reset_counters(dev); mt7615_mac_reset_counters(dev);
out: out:
clear_bit(MT76_RESET, &dev->mt76.state); clear_bit(MT76_RESET, &dev->mphy.state);
mutex_unlock(&dev->mt76.mutex); mutex_unlock(&dev->mt76.mutex);
mt76_txq_schedule_all(&dev->mphy); mt76_txq_schedule_all(&dev->mphy);
......
...@@ -104,7 +104,7 @@ static int __mt7615_mcu_msg_send(struct mt7615_dev *dev, struct sk_buff *skb, ...@@ -104,7 +104,7 @@ static int __mt7615_mcu_msg_send(struct mt7615_dev *dev, struct sk_buff *skb,
if (wait_seq) if (wait_seq)
*wait_seq = 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; qid = MT_TXQ_MCU;
else else
qid = MT_TXQ_FWDL; qid = MT_TXQ_FWDL;
...@@ -561,7 +561,7 @@ int mt7615_mcu_init(struct mt7615_dev *dev) ...@@ -561,7 +561,7 @@ int mt7615_mcu_init(struct mt7615_dev *dev)
if (ret) if (ret)
return ret; return ret;
set_bit(MT76_STATE_MCU_RUNNING, &dev->mt76.state); set_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state);
return 0; return 0;
} }
......
...@@ -43,7 +43,7 @@ static irqreturn_t mt7615_irq_handler(int irq, void *dev_instance) ...@@ -43,7 +43,7 @@ static irqreturn_t mt7615_irq_handler(int irq, void *dev_instance)
intr = mt76_rr(dev, MT_INT_SOURCE_CSR); intr = mt76_rr(dev, MT_INT_SOURCE_CSR);
mt76_wr(dev, MT_INT_SOURCE_CSR, intr); 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; return IRQ_NONE;
intr &= dev->mt76.mmio.irqmask; intr &= dev->mt76.mmio.irqmask;
......
...@@ -46,7 +46,7 @@ int mt76x0_config(struct ieee80211_hw *hw, u32 changed) ...@@ -46,7 +46,7 @@ int mt76x0_config(struct ieee80211_hw *hw, u32 changed)
if (changed & IEEE80211_CONF_CHANGE_POWER) { if (changed & IEEE80211_CONF_CHANGE_POWER) {
dev->mt76.txpower_conf = hw->conf.power_level * 2; 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); mt76x0_phy_set_txpower(dev);
} }
......
...@@ -20,7 +20,7 @@ static int mt76x0e_start(struct ieee80211_hw *hw) ...@@ -20,7 +20,7 @@ static int mt76x0e_start(struct ieee80211_hw *hw)
MT_MAC_WORK_INTERVAL); MT_MAC_WORK_INTERVAL);
ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work, ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
MT_CALIBRATE_INTERVAL); MT_CALIBRATE_INTERVAL);
set_bit(MT76_STATE_RUNNING, &dev->mt76.state); set_bit(MT76_STATE_RUNNING, &dev->mphy.state);
return 0; return 0;
} }
...@@ -47,7 +47,7 @@ static void mt76x0e_stop(struct ieee80211_hw *hw) ...@@ -47,7 +47,7 @@ static void mt76x0e_stop(struct ieee80211_hw *hw)
{ {
struct mt76x02_dev *dev = hw->priv; 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); mt76x0e_stop_hw(dev);
} }
...@@ -124,7 +124,7 @@ static int mt76x0e_register_device(struct mt76x02_dev *dev) ...@@ -124,7 +124,7 @@ static int mt76x0e_register_device(struct mt76x02_dev *dev)
if (err < 0) if (err < 0)
return err; return err;
set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state); set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
return 0; return 0;
} }
...@@ -195,7 +195,7 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -195,7 +195,7 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
static void mt76x0e_cleanup(struct mt76x02_dev *dev) 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); tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
mt76x0_chip_onoff(dev, false, false); mt76x0_chip_onoff(dev, false, false);
mt76x0e_stop_hw(dev); mt76x0e_stop_hw(dev);
......
...@@ -126,7 +126,7 @@ int mt76x0e_mcu_init(struct mt76x02_dev *dev) ...@@ -126,7 +126,7 @@ int mt76x0e_mcu_init(struct mt76x02_dev *dev)
if (err < 0) if (err < 0)
return err; return err;
set_bit(MT76_STATE_MCU_RUNNING, &dev->mt76.state); set_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state);
return 0; return 0;
} }
...@@ -23,7 +23,7 @@ mt76x0_rf_csr_wr(struct mt76x02_dev *dev, u32 offset, u8 value) ...@@ -23,7 +23,7 @@ mt76x0_rf_csr_wr(struct mt76x02_dev *dev, u32 offset, u8 value)
int ret = 0; int ret = 0;
u8 bank, reg; u8 bank, reg;
if (test_bit(MT76_REMOVED, &dev->mt76.state)) if (test_bit(MT76_REMOVED, &dev->mphy.state))
return -ENODEV; return -ENODEV;
bank = MT_RF_BANK(offset); bank = MT_RF_BANK(offset);
...@@ -62,7 +62,7 @@ static int mt76x0_rf_csr_rr(struct mt76x02_dev *dev, u32 offset) ...@@ -62,7 +62,7 @@ static int mt76x0_rf_csr_rr(struct mt76x02_dev *dev, u32 offset)
u32 val; u32 val;
u8 bank, reg; u8 bank, reg;
if (test_bit(MT76_REMOVED, &dev->mt76.state)) if (test_bit(MT76_REMOVED, &dev->mphy.state))
return -ENODEV; return -ENODEV;
bank = MT_RF_BANK(offset); bank = MT_RF_BANK(offset);
...@@ -109,7 +109,7 @@ mt76x0_rf_wr(struct mt76x02_dev *dev, u32 offset, u8 val) ...@@ -109,7 +109,7 @@ mt76x0_rf_wr(struct mt76x02_dev *dev, u32 offset, u8 val)
}; };
WARN_ON_ONCE(!test_bit(MT76_STATE_MCU_RUNNING, 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); return mt76_wr_rp(dev, MT_MCU_MEMMAP_RF, &pair, 1);
} else { } else {
return mt76x0_rf_csr_wr(dev, offset, val); return mt76x0_rf_csr_wr(dev, offset, val);
...@@ -127,7 +127,7 @@ static int mt76x0_rf_rr(struct mt76x02_dev *dev, u32 offset) ...@@ -127,7 +127,7 @@ static int mt76x0_rf_rr(struct mt76x02_dev *dev, u32 offset)
}; };
WARN_ON_ONCE(!test_bit(MT76_STATE_MCU_RUNNING, 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); ret = mt76_rd_rp(dev, MT_MCU_MEMMAP_RF, &pair, 1);
val = pair.value; val = pair.value;
} else { } else {
...@@ -933,7 +933,7 @@ void mt76x0_phy_set_channel(struct mt76x02_dev *dev, ...@@ -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_CCA3, 0) |
FIELD_PREP(MT_EXT_CCA_CFG_CCA_MASK, BIT(3)), 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; int ch_group_index, freq, freq1;
u8 channel; u8 channel;
u32 val; u32 val;
......
...@@ -71,7 +71,7 @@ static void mt76x0_init_usb_dma(struct mt76x02_dev *dev) ...@@ -71,7 +71,7 @@ static void mt76x0_init_usb_dma(struct mt76x02_dev *dev)
static void mt76x0u_cleanup(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); mt76x0_chip_onoff(dev, false, false);
mt76u_queues_deinit(&dev->mt76); mt76u_queues_deinit(&dev->mt76);
} }
...@@ -80,13 +80,13 @@ static void mt76x0u_stop(struct ieee80211_hw *hw) ...@@ -80,13 +80,13 @@ static void mt76x0u_stop(struct ieee80211_hw *hw)
{ {
struct mt76x02_dev *dev = hw->priv; 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->cal_work);
cancel_delayed_work_sync(&dev->mt76.mac_work); cancel_delayed_work_sync(&dev->mt76.mac_work);
mt76u_stop_tx(&dev->mt76); mt76u_stop_tx(&dev->mt76);
mt76x02u_exit_beacon_config(dev); mt76x02u_exit_beacon_config(dev);
if (test_bit(MT76_REMOVED, &dev->mt76.state)) if (test_bit(MT76_REMOVED, &dev->mphy.state))
return; return;
if (!mt76_poll(dev, MT_USB_DMA_CFG, MT_USB_DMA_CFG_TX_BUSY, 0, 1000)) 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) ...@@ -112,7 +112,7 @@ static int mt76x0u_start(struct ieee80211_hw *hw)
MT_MAC_WORK_INTERVAL); MT_MAC_WORK_INTERVAL);
ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work, ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
MT_CALIBRATE_INTERVAL); MT_CALIBRATE_INTERVAL);
set_bit(MT76_STATE_RUNNING, &dev->mt76.state); set_bit(MT76_STATE_RUNNING, &dev->mphy.state);
return 0; return 0;
} }
...@@ -192,7 +192,7 @@ static int mt76x0u_register_device(struct mt76x02_dev *dev) ...@@ -192,7 +192,7 @@ static int mt76x0u_register_device(struct mt76x02_dev *dev)
else else
hw->max_tx_fragments = 1; hw->max_tx_fragments = 1;
set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state); set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
return 0; return 0;
...@@ -283,7 +283,7 @@ static int mt76x0u_probe(struct usb_interface *usb_intf, ...@@ -283,7 +283,7 @@ static int mt76x0u_probe(struct usb_interface *usb_intf,
static void mt76x0_disconnect(struct usb_interface *usb_intf) static void mt76x0_disconnect(struct usb_interface *usb_intf)
{ {
struct mt76x02_dev *dev = usb_get_intfdata(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) if (!initialized)
return; return;
...@@ -304,7 +304,7 @@ static int __maybe_unused mt76x0_suspend(struct usb_interface *usb_intf, ...@@ -304,7 +304,7 @@ static int __maybe_unused mt76x0_suspend(struct usb_interface *usb_intf,
struct mt76x02_dev *dev = usb_get_intfdata(usb_intf); struct mt76x02_dev *dev = usb_get_intfdata(usb_intf);
mt76u_stop_rx(&dev->mt76); 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); mt76x0_chip_onoff(dev, false, false);
return 0; return 0;
......
...@@ -168,7 +168,7 @@ int mt76x0u_mcu_init(struct mt76x02_dev *dev) ...@@ -168,7 +168,7 @@ int mt76x0u_mcu_init(struct mt76x02_dev *dev)
if (ret < 0) if (ret < 0)
return ret; return ret;
set_bit(MT76_STATE_MCU_RUNNING, &dev->mt76.state); set_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state);
return 0; return 0;
} }
...@@ -616,7 +616,7 @@ static void mt76x02_dfs_tasklet(unsigned long arg) ...@@ -616,7 +616,7 @@ static void mt76x02_dfs_tasklet(unsigned long arg)
u32 engine_mask; u32 engine_mask;
int i; int i;
if (test_bit(MT76_SCANNING, &dev->mt76.state)) if (test_bit(MT76_SCANNING, &dev->mphy.state))
goto out; goto out;
if (time_is_before_jiffies(dfs_pd->last_sw_check + if (time_is_before_jiffies(dfs_pd->last_sw_check +
......
...@@ -775,7 +775,7 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb, ...@@ -775,7 +775,7 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb,
u8 wcid; u8 wcid;
int len; int len;
if (!test_bit(MT76_STATE_RUNNING, &dev->mt76.state)) if (!test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
return -EINVAL; return -EINVAL;
if (rxinfo & MT_RXINFO_L2PAD) if (rxinfo & MT_RXINFO_L2PAD)
...@@ -868,7 +868,7 @@ void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq) ...@@ -868,7 +868,7 @@ void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq)
u8 update = 1; u8 update = 1;
bool ret; bool ret;
if (!test_bit(MT76_STATE_RUNNING, &dev->mt76.state)) if (!test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
return; return;
trace_mac_txstat_poll(dev); trace_mac_txstat_poll(dev);
......
...@@ -152,7 +152,7 @@ static inline bool mt76x02_wait_for_mac(struct mt76_dev *dev) ...@@ -152,7 +152,7 @@ static inline bool mt76x02_wait_for_mac(struct mt76_dev *dev)
int i; int i;
for (i = 0; i < 500; i++) { for (i = 0; i < 500; i++) {
if (test_bit(MT76_REMOVED, &dev->state)) if (test_bit(MT76_REMOVED, &dev->phy.state))
return false; return false;
switch (dev->bus->rr(dev, MAC_CSR0)) { switch (dev->bus->rr(dev, MAC_CSR0)) {
......
...@@ -261,7 +261,7 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance) ...@@ -261,7 +261,7 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance)
intr = mt76_rr(dev, MT_INT_SOURCE_CSR); intr = mt76_rr(dev, MT_INT_SOURCE_CSR);
mt76_wr(dev, MT_INT_SOURCE_CSR, intr); 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; return IRQ_NONE;
trace_dev_irq(dev, intr, dev->mt76.mmio.irqmask); trace_dev_irq(dev, intr, dev->mt76.mmio.irqmask);
...@@ -402,7 +402,7 @@ static void mt76x02_reset_state(struct mt76x02_dev *dev) ...@@ -402,7 +402,7 @@ static void mt76x02_reset_state(struct mt76x02_dev *dev)
lockdep_assert_held(&dev->mt76.mutex); 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(); rcu_read_lock();
ieee80211_iter_keys_rcu(dev->mt76.hw, NULL, mt76x02_key_sync, NULL); 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) ...@@ -441,7 +441,7 @@ static void mt76x02_watchdog_reset(struct mt76x02_dev *dev)
int i; int i;
ieee80211_stop_queues(dev->mt76.hw); 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.pre_tbtt_tasklet);
tasklet_disable(&dev->mt76.tx_tasklet); tasklet_disable(&dev->mt76.tx_tasklet);
...@@ -496,7 +496,7 @@ static void mt76x02_watchdog_reset(struct mt76x02_dev *dev) ...@@ -496,7 +496,7 @@ static void mt76x02_watchdog_reset(struct mt76x02_dev *dev)
mutex_unlock(&dev->mt76.mutex); 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); tasklet_enable(&dev->mt76.tx_tasklet);
napi_enable(&dev->mt76.tx_napi); napi_enable(&dev->mt76.tx_napi);
......
...@@ -280,7 +280,7 @@ EXPORT_SYMBOL_GPL(mt76x02u_init_beacon_config); ...@@ -280,7 +280,7 @@ EXPORT_SYMBOL_GPL(mt76x02u_init_beacon_config);
void mt76x02u_exit_beacon_config(struct mt76x02_dev *dev) 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, mt76_clear(dev, MT_BEACON_TIME_CFG,
MT_BEACON_TIME_CFG_TIMER_EN | MT_BEACON_TIME_CFG_TIMER_EN |
MT_BEACON_TIME_CFG_SYNC_MODE | MT_BEACON_TIME_CFG_SYNC_MODE |
......
...@@ -87,7 +87,7 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb, ...@@ -87,7 +87,7 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
u8 seq = 0; u8 seq = 0;
u32 info; u32 info;
if (test_bit(MT76_REMOVED, &dev->state)) if (test_bit(MT76_REMOVED, &dev->phy.state))
return 0; return 0;
if (wait_resp) { if (wait_resp) {
......
...@@ -602,7 +602,7 @@ void mt76x02_sw_scan_complete(struct ieee80211_hw *hw, ...@@ -602,7 +602,7 @@ void mt76x02_sw_scan_complete(struct ieee80211_hw *hw,
{ {
struct mt76x02_dev *dev = hw->priv; 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) { if (dev->cal.gain_init_done) {
/* Restore AGC gain and resume calibration after scanning. */ /* Restore AGC gain and resume calibration after scanning. */
dev->cal.low_gain = -1; dev->cal.low_gain = -1;
......
...@@ -239,7 +239,7 @@ static int mt76x2_init_hardware(struct mt76x02_dev *dev) ...@@ -239,7 +239,7 @@ static int mt76x2_init_hardware(struct mt76x02_dev *dev)
if (ret) if (ret)
return ret; return ret;
set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state); set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
mt76x02_mac_start(dev); mt76x02_mac_start(dev);
ret = mt76x2_mcu_init(dev); ret = mt76x2_mcu_init(dev);
......
...@@ -22,7 +22,7 @@ mt76x2_start(struct ieee80211_hw *hw) ...@@ -22,7 +22,7 @@ mt76x2_start(struct ieee80211_hw *hw)
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->wdt_work, ieee80211_queue_delayed_work(mt76_hw(dev), &dev->wdt_work,
MT_WATCHDOG_TIME); MT_WATCHDOG_TIME);
set_bit(MT76_STATE_RUNNING, &dev->mt76.state); set_bit(MT76_STATE_RUNNING, &dev->mphy.state);
return 0; return 0;
} }
...@@ -31,7 +31,7 @@ mt76x2_stop(struct ieee80211_hw *hw) ...@@ -31,7 +31,7 @@ mt76x2_stop(struct ieee80211_hw *hw)
{ {
struct mt76x02_dev *dev = hw->priv; 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); mt76x2_stop_hardware(dev);
} }
...@@ -45,7 +45,7 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef) ...@@ -45,7 +45,7 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
tasklet_disable(&dev->dfs_pd.dfs_tasklet); tasklet_disable(&dev->dfs_pd.dfs_tasklet);
mutex_lock(&dev->mt76.mutex); mutex_lock(&dev->mt76.mutex);
set_bit(MT76_RESET, &dev->mt76.state); set_bit(MT76_RESET, &dev->mphy.state);
mt76_set_channel(&dev->mphy); mt76_set_channel(&dev->mphy);
...@@ -57,7 +57,7 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef) ...@@ -57,7 +57,7 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
mt76x2_mac_resume(dev); mt76x2_mac_resume(dev);
clear_bit(MT76_RESET, &dev->mt76.state); clear_bit(MT76_RESET, &dev->mphy.state);
mutex_unlock(&dev->mt76.mutex); mutex_unlock(&dev->mt76.mutex);
tasklet_enable(&dev->dfs_pd.dfs_tasklet); tasklet_enable(&dev->dfs_pd.dfs_tasklet);
...@@ -91,7 +91,7 @@ mt76x2_config(struct ieee80211_hw *hw, u32 changed) ...@@ -91,7 +91,7 @@ mt76x2_config(struct ieee80211_hw *hw, u32 changed)
/* convert to per-chain power for 2x2 devices */ /* convert to per-chain power for 2x2 devices */
dev->mt76.txpower_conf -= 6; 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); mt76x2_phy_set_txpower(dev);
mt76x02_tx_set_txpwr_auto(dev, dev->mt76.txpower_conf); mt76x02_tx_set_txpwr_auto(dev, dev->mt76.txpower_conf);
} }
......
...@@ -118,7 +118,7 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev, ...@@ -118,7 +118,7 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev,
struct cfg80211_chan_def *chandef) struct cfg80211_chan_def *chandef)
{ {
struct ieee80211_channel *chan = chandef->chan; 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; enum nl80211_band band = chan->band;
u8 channel; u8 channel;
......
...@@ -86,7 +86,7 @@ static void mt76x2u_disconnect(struct usb_interface *intf) ...@@ -86,7 +86,7 @@ static void mt76x2u_disconnect(struct usb_interface *intf)
struct mt76x02_dev *dev = usb_get_intfdata(intf); struct mt76x02_dev *dev = usb_get_intfdata(intf);
struct ieee80211_hw *hw = mt76_hw(dev); 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); ieee80211_unregister_hw(hw);
mt76x2u_cleanup(dev); mt76x2u_cleanup(dev);
mt76u_deinit(&dev->mt76); mt76u_deinit(&dev->mt76);
......
...@@ -218,7 +218,7 @@ int mt76x2u_register_device(struct mt76x02_dev *dev) ...@@ -218,7 +218,7 @@ int mt76x2u_register_device(struct mt76x02_dev *dev)
else else
hw->max_tx_fragments = 1; 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); mt76x02_init_debugfs(dev);
mt76x2_init_txpower(dev, &dev->mphy.sband_2g.sband); mt76x2_init_txpower(dev, &dev->mphy.sband_2g.sband);
......
...@@ -98,7 +98,7 @@ int mt76x2u_mac_stop(struct mt76x02_dev *dev) ...@@ -98,7 +98,7 @@ int mt76x2u_mac_stop(struct mt76x02_dev *dev)
bool stopped = false; bool stopped = false;
u32 rts_cfg; u32 rts_cfg;
if (test_bit(MT76_REMOVED, &dev->mt76.state)) if (test_bit(MT76_REMOVED, &dev->mphy.state))
return -EIO; return -EIO;
rts_cfg = mt76_rr(dev, MT_TX_RTS_CFG); rts_cfg = mt76_rr(dev, MT_TX_RTS_CFG);
......
...@@ -17,7 +17,7 @@ static int mt76x2u_start(struct ieee80211_hw *hw) ...@@ -17,7 +17,7 @@ static int mt76x2u_start(struct ieee80211_hw *hw)
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work, ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mt76.mac_work,
MT_MAC_WORK_INTERVAL); MT_MAC_WORK_INTERVAL);
set_bit(MT76_STATE_RUNNING, &dev->mt76.state); set_bit(MT76_STATE_RUNNING, &dev->mphy.state);
return 0; return 0;
} }
...@@ -26,7 +26,7 @@ static void mt76x2u_stop(struct ieee80211_hw *hw) ...@@ -26,7 +26,7 @@ static void mt76x2u_stop(struct ieee80211_hw *hw)
{ {
struct mt76x02_dev *dev = hw->priv; 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); mt76u_stop_tx(&dev->mt76);
mt76x2u_stop_hw(dev); mt76x2u_stop_hw(dev);
} }
...@@ -41,7 +41,7 @@ mt76x2u_set_channel(struct mt76x02_dev *dev, ...@@ -41,7 +41,7 @@ mt76x2u_set_channel(struct mt76x02_dev *dev,
mt76x02_pre_tbtt_enable(dev, false); mt76x02_pre_tbtt_enable(dev, false);
mutex_lock(&dev->mt76.mutex); mutex_lock(&dev->mt76.mutex);
set_bit(MT76_RESET, &dev->mt76.state); set_bit(MT76_RESET, &dev->mphy.state);
mt76_set_channel(&dev->mphy); mt76_set_channel(&dev->mphy);
...@@ -52,7 +52,7 @@ mt76x2u_set_channel(struct mt76x02_dev *dev, ...@@ -52,7 +52,7 @@ mt76x2u_set_channel(struct mt76x02_dev *dev,
mt76x02_mac_cc_reset(dev); mt76x02_mac_cc_reset(dev);
mt76x2_mac_resume(dev); mt76x2_mac_resume(dev);
clear_bit(MT76_RESET, &dev->mt76.state); clear_bit(MT76_RESET, &dev->mphy.state);
mutex_unlock(&dev->mt76.mutex); mutex_unlock(&dev->mt76.mutex);
mt76x02_pre_tbtt_enable(dev, true); mt76x02_pre_tbtt_enable(dev, true);
...@@ -83,7 +83,7 @@ mt76x2u_config(struct ieee80211_hw *hw, u32 changed) ...@@ -83,7 +83,7 @@ mt76x2u_config(struct ieee80211_hw *hw, u32 changed)
/* convert to per-chain power for 2x2 devices */ /* convert to per-chain power for 2x2 devices */
dev->mt76.txpower_conf -= 6; 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); mt76x2_phy_set_txpower(dev);
} }
......
...@@ -82,7 +82,7 @@ int mt76x2u_phy_set_channel(struct mt76x02_dev *dev, ...@@ -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_CCA3, 0) |
FIELD_PREP(MT_EXT_CCA_CFG_CCA_MASK, BIT(3)), 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; struct ieee80211_channel *chan = chandef->chan;
u8 channel = chan->hw_value, bw, bw_index; u8 channel = chan->hw_value, bw, bw_index;
int ch_group_index, freq, freq1, ret; int ch_group_index, freq, freq1, ret;
......
...@@ -442,7 +442,7 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_sw_queue *sq, ...@@ -442,7 +442,7 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_sw_queue *sq,
if (probe) if (probe)
break; break;
if (test_bit(MT76_RESET, &dev->state)) if (test_bit(MT76_RESET, &phy->state))
return -EBUSY; return -EBUSY;
skb = mt76_txq_dequeue(phy, mtxq, false); skb = mt76_txq_dequeue(phy, mtxq, false);
...@@ -498,7 +498,7 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid) ...@@ -498,7 +498,7 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid)
if (sq->swq_queued >= 4) if (sq->swq_queued >= 4)
break; break;
if (test_bit(MT76_RESET, &dev->state)) { if (test_bit(MT76_RESET, &phy->state)) {
ret = -EBUSY; ret = -EBUSY;
break; break;
} }
...@@ -604,7 +604,7 @@ void mt76_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq) ...@@ -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_phy *phy = hw->priv;
struct mt76_dev *dev = phy->dev; struct mt76_dev *dev = phy->dev;
if (!test_bit(MT76_STATE_RUNNING, &dev->state)) if (!test_bit(MT76_STATE_RUNNING, &phy->state))
return; return;
tasklet_schedule(&dev->tx_tasklet); tasklet_schedule(&dev->tx_tasklet);
......
...@@ -29,13 +29,13 @@ static int __mt76u_vendor_request(struct mt76_dev *dev, u8 req, ...@@ -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) pipe = (req_type & USB_DIR_IN) ? usb_rcvctrlpipe(udev, 0)
: usb_sndctrlpipe(udev, 0); : usb_sndctrlpipe(udev, 0);
for (i = 0; i < MT_VEND_REQ_MAX_RETRY; i++) { 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; return -EIO;
ret = usb_control_msg(udev, pipe, req, req_type, val, ret = usb_control_msg(udev, pipe, req, req_type, val,
offset, buf, len, MT_VEND_REQ_TOUT_MS); offset, buf, len, MT_VEND_REQ_TOUT_MS);
if (ret == -ENODEV) if (ret == -ENODEV)
set_bit(MT76_REMOVED, &dev->state); set_bit(MT76_REMOVED, &dev->phy.state);
if (ret >= 0 || ret == -ENODEV) if (ret >= 0 || ret == -ENODEV)
return ret; return ret;
usleep_range(5000, 10000); usleep_range(5000, 10000);
...@@ -200,7 +200,7 @@ static int ...@@ -200,7 +200,7 @@ static int
mt76u_wr_rp(struct mt76_dev *dev, u32 base, mt76u_wr_rp(struct mt76_dev *dev, u32 base,
const struct mt76_reg_pair *data, int n) 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); return dev->mcu_ops->mcu_wr_rp(dev, base, data, n);
else else
return mt76u_req_wr_rp(dev, base, data, n); return mt76u_req_wr_rp(dev, base, data, n);
...@@ -227,7 +227,7 @@ static int ...@@ -227,7 +227,7 @@ static int
mt76u_rd_rp(struct mt76_dev *dev, u32 base, mt76u_rd_rp(struct mt76_dev *dev, u32 base,
struct mt76_reg_pair *data, int n) 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); return dev->mcu_ops->mcu_rd_rp(dev, base, data, n);
else else
return mt76u_req_rd_rp(dev, base, data, n); return mt76u_req_rd_rp(dev, base, data, n);
...@@ -464,7 +464,7 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb) ...@@ -464,7 +464,7 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb)
int len, nsgs = 1; int len, nsgs = 1;
struct sk_buff *skb; struct sk_buff *skb;
if (!test_bit(MT76_STATE_INITIALIZED, &dev->state)) if (!test_bit(MT76_STATE_INITIALIZED, &dev->phy.state))
return 0; return 0;
len = mt76u_get_rx_entry_len(data, urb->actual_length); len = mt76u_get_rx_entry_len(data, urb->actual_length);
...@@ -696,7 +696,7 @@ static void mt76u_tx_tasklet(unsigned long data) ...@@ -696,7 +696,7 @@ static void mt76u_tx_tasklet(unsigned long data)
mt76_txq_schedule(&dev->phy, i); 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); queue_work(dev->usb.stat_wq, &dev->usb.stat_work);
if (wake) if (wake)
ieee80211_wake_queue(dev->hw, i); ieee80211_wake_queue(dev->hw, i);
...@@ -714,7 +714,7 @@ static void mt76u_tx_status_data(struct work_struct *work) ...@@ -714,7 +714,7 @@ static void mt76u_tx_status_data(struct work_struct *work)
dev = container_of(usb, struct mt76_dev, usb); dev = container_of(usb, struct mt76_dev, usb);
while (true) { while (true) {
if (test_bit(MT76_REMOVED, &dev->state)) if (test_bit(MT76_REMOVED, &dev->phy.state))
break; break;
if (!dev->drv->tx_status_data(dev, &update)) if (!dev->drv->tx_status_data(dev, &update))
...@@ -722,10 +722,10 @@ static void mt76u_tx_status_data(struct work_struct *work) ...@@ -722,10 +722,10 @@ static void mt76u_tx_status_data(struct work_struct *work)
count++; 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); queue_work(usb->stat_wq, &usb->stat_work);
else else
clear_bit(MT76_READING_STATS, &dev->state); clear_bit(MT76_READING_STATS, &dev->phy.state);
} }
static void mt76u_complete_tx(struct urb *urb) 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) ...@@ -806,7 +806,7 @@ static void mt76u_tx_kick(struct mt76_dev *dev, struct mt76_queue *q)
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err < 0) { if (err < 0) {
if (err == -ENODEV) if (err == -ENODEV)
set_bit(MT76_REMOVED, &dev->state); set_bit(MT76_REMOVED, &dev->phy.state);
else else
dev_err(dev->dev, "tx urb submit failed:%d\n", dev_err(dev->dev, "tx urb submit failed:%d\n",
err); err);
...@@ -905,7 +905,7 @@ void mt76u_stop_tx(struct mt76_dev *dev) ...@@ -905,7 +905,7 @@ void mt76u_stop_tx(struct mt76_dev *dev)
} }
cancel_work_sync(&dev->usb.stat_work); 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); mt76_tx_status_check(dev, NULL, true);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment