if (!mt7615_wait_for_mcu_init(dev))
return -EIO;
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
running = mt7615_dev_running(dev);
if (!running)
mt7615_mac_reset_counters(dev);
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
return 0;
}
cancel_work_sync(&dev->pm.wake_work);
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
mt76_testmode_reset(&dev->mt76, true);
mt7615_mcu_set_mac_enable(dev, 0, false);
}
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
}
static int get_omac_idx(enum nl80211_iftype type, u32 mask)
bool ext_phy = phy != &dev->phy;
int idx, ret = 0;
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
mt76_testmode_reset(&dev->mt76, true);
ret = mt7615_mcu_add_dev_info(dev, vif, true);
out:
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
return ret;
}
/* TODO: disable beacon for the bss */
- mutex_lock(&dev->mt76.mutex);
- mt76_testmode_reset(&dev->mt76, true);
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
+ mt76_testmode_reset(&dev->mt76, true);
if (vif == phy->monitor_vif)
phy->monitor_vif = NULL;
if (vif->txq)
mt76_txq_remove(&dev->mt76, vif->txq);
- mutex_lock(&dev->mt76.mutex);
dev->mphy.vif_mask &= ~BIT(mvif->idx);
dev->omac_mask &= ~BIT(mvif->omac_idx);
phy->omac_mask &= ~BIT(mvif->omac_idx);
- mutex_unlock(&dev->mt76.mutex);
+
+ mt7615_mutex_release(dev);
spin_lock_bh(&dev->sta_poll_lock);
if (!list_empty(&msta->poll_list))
cancel_delayed_work_sync(&phy->mac_work);
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
+
set_bit(MT76_RESET, &phy->mt76->state);
mt7615_init_dfs_state(phy);
out:
clear_bit(MT76_RESET, &phy->mt76->state);
- mutex_unlock(&dev->mt76.mutex);
+
+ mt7615_mutex_release(dev);
mt76_txq_schedule_all(phy->mt76);
IEEE80211_CONF_CHANGE_POWER)) {
#ifdef CONFIG_NL80211_TESTMODE
if (dev->mt76.test.state != MT76_TM_STATE_OFF) {
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
mt76_testmode_reset(&dev->mt76, false);
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
}
#endif
ieee80211_stop_queues(hw);
ieee80211_wake_queues(hw);
}
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
if (changed & IEEE80211_CONF_CHANGE_MONITOR) {
mt76_testmode_reset(&dev->mt76, true);
mt76_wr(dev, MT_WF_RFCR(band), phy->rxfilter);
}
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
return ret;
}
MT_WF_RFCR1_DROP_CFACK;
u32 flags = 0;
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
#define MT76_FILTER(_flag, _hw) do { \
flags |= *total_flags & FIF_##_flag; \
else
mt76_set(dev, MT_WF_RFCR1(band), ctl_flags);
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
}
static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
struct mt7615_dev *dev = mt7615_hw_dev(hw);
struct mt7615_phy *phy = mt7615_hw_phy(hw);
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
if (changed & BSS_CHANGED_ERP_SLOT) {
int slottime = info->use_short_slot ? 9 : 20;
if (changed & BSS_CHANGED_ARP_FILTER)
mt7615_mcu_update_arp_filter(hw, vif, info);
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
}
static void
{
struct mt7615_dev *dev = mt7615_hw_dev(hw);
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
mt7615_mcu_add_beacon(dev, hw, vif, true);
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
}
int mt7615_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct mt7615_dev *dev = mt7615_hw_dev(hw);
struct mt7615_phy *phy = mt7615_hw_phy(hw);
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
mt7615_mcu_set_rts_thresh(phy, val);
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
return 0;
}
mtxq = (struct mt76_txq *)txq->drv_priv;
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
+
switch (action) {
case IEEE80211_AMPDU_RX_START:
mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid, ssn,
ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
break;
}
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
return ret;
}
u32 t32[2];
} tsf;
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
mt76_set(dev, MT_LPON_T0CR, MT_LPON_T0CR_MODE); /* TSF read */
tsf.t32[0] = mt76_rr(dev, MT_LPON_UTTR0);
tsf.t32[1] = mt76_rr(dev, MT_LPON_UTTR1);
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
return tsf.t64;
}
u32 t32[2];
} tsf = { .t64 = timestamp, };
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
mt76_wr(dev, MT_LPON_UTTR0, tsf.t32[0]);
mt76_wr(dev, MT_LPON_UTTR1, tsf.t32[1]);
/* TSF software overwrite */
mt76_set(dev, MT_LPON_T0CR, MT_LPON_T0CR_WRITE);
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
}
static void
struct mt7615_phy *phy = mt7615_hw_phy(hw);
struct mt7615_dev *dev = phy->dev;
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
phy->coverage_class = max_t(s16, coverage_class, 0);
mt7615_mac_set_timing(phy);
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
}
static int
if ((BIT(hweight8(tx_ant)) - 1) != tx_ant)
tx_ant = BIT(ffs(tx_ant) - 1) - 1;
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
phy->mt76->antenna_mask = tx_ant;
if (ext_phy) {
mt76_set_stream_caps(phy->mt76, true);
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
return 0;
}
bool ext_phy = phy != &dev->phy;
int err = 0;
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
clear_bit(MT76_STATE_RUNNING, &phy->mt76->state);
cancel_delayed_work_sync(&phy->scan_work);
if (!mt7615_dev_running(dev))
err = mt7615_mcu_set_hif_suspend(dev, true);
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
return err;
}
struct mt7615_phy *phy = mt7615_hw_phy(hw);
bool running, ext_phy = phy != &dev->phy;
- mutex_lock(&dev->mt76.mutex);
+ mt7615_mutex_acquire(dev);
running = mt7615_dev_running(dev);
set_bit(MT76_STATE_RUNNING, &phy->mt76->state);
err = mt7615_mcu_set_hif_suspend(dev, false);
if (err < 0) {
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
return err;
}
}
MT7615_WATCHDOG_TIME);
mt76_clear(dev, MT_WF_RFCR(ext_phy), MT_WF_RFCR_DROP_OTHER_BEACON);
- mutex_unlock(&dev->mt76.mutex);
+ mt7615_mutex_release(dev);
return 0;
}