Commit 20249e1a authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

wifi: mt76: mt7921: move mt792x_hw_dev in mt792x.h

This is a preliminary patch to introduce WiFi7 chipset support
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarDeren Wu <deren.wu@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent c605d0ce
...@@ -110,7 +110,7 @@ mt7921_regd_notifier(struct wiphy *wiphy, ...@@ -110,7 +110,7 @@ mt7921_regd_notifier(struct wiphy *wiphy,
struct regulatory_request *request) struct regulatory_request *request)
{ {
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
memcpy(dev->mt76.alpha2, request->alpha2, sizeof(dev->mt76.alpha2)); memcpy(dev->mt76.alpha2, request->alpha2, sizeof(dev->mt76.alpha2));
dev->mt76.region = request->dfs_region; dev->mt76.region = request->dfs_region;
......
...@@ -264,7 +264,7 @@ static int mt7921_start(struct ieee80211_hw *hw) ...@@ -264,7 +264,7 @@ static int mt7921_start(struct ieee80211_hw *hw)
void mt7921_stop(struct ieee80211_hw *hw) void mt7921_stop(struct ieee80211_hw *hw)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt792x_phy *phy = mt7921_hw_phy(hw); struct mt792x_phy *phy = mt7921_hw_phy(hw);
cancel_delayed_work_sync(&phy->mt76->mac_work); cancel_delayed_work_sync(&phy->mt76->mac_work);
...@@ -285,7 +285,7 @@ static int mt7921_add_interface(struct ieee80211_hw *hw, ...@@ -285,7 +285,7 @@ static int mt7921_add_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt792x_phy *phy = mt7921_hw_phy(hw); struct mt792x_phy *phy = mt7921_hw_phy(hw);
struct mt76_txq *mtxq; struct mt76_txq *mtxq;
int idx, ret = 0; int idx, ret = 0;
...@@ -343,7 +343,7 @@ static void mt7921_remove_interface(struct ieee80211_hw *hw, ...@@ -343,7 +343,7 @@ static void mt7921_remove_interface(struct ieee80211_hw *hw,
{ {
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_sta *msta = &mvif->sta; struct mt792x_sta *msta = &mvif->sta;
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt792x_phy *phy = mt7921_hw_phy(hw); struct mt792x_phy *phy = mt7921_hw_phy(hw);
int idx = msta->wcid.idx; int idx = msta->wcid.idx;
...@@ -506,7 +506,7 @@ static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ...@@ -506,7 +506,7 @@ static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_vif *vif, struct ieee80211_sta *sta,
struct ieee80211_key_conf *key) struct ieee80211_key_conf *key)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv : struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv :
&mvif->sta; &mvif->sta;
...@@ -630,7 +630,7 @@ void mt7921_set_runtime_pm(struct mt792x_dev *dev) ...@@ -630,7 +630,7 @@ void mt7921_set_runtime_pm(struct mt792x_dev *dev)
static int mt7921_config(struct ieee80211_hw *hw, u32 changed) static int mt7921_config(struct ieee80211_hw *hw, u32 changed)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt792x_phy *phy = mt7921_hw_phy(hw); struct mt792x_phy *phy = mt7921_hw_phy(hw);
int ret = 0; int ret = 0;
...@@ -686,7 +686,7 @@ static void mt7921_configure_filter(struct ieee80211_hw *hw, ...@@ -686,7 +686,7 @@ static void mt7921_configure_filter(struct ieee80211_hw *hw,
#define MT7921_FILTER_OTHER_BSS BIT(6) #define MT7921_FILTER_OTHER_BSS BIT(6)
#define MT7921_FILTER_ENABLE BIT(31) #define MT7921_FILTER_ENABLE BIT(31)
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
u32 flags = MT7921_FILTER_ENABLE; u32 flags = MT7921_FILTER_ENABLE;
#define MT7921_FILTER(_fif, _type) do { \ #define MT7921_FILTER(_fif, _type) do { \
...@@ -711,7 +711,7 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw, ...@@ -711,7 +711,7 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw,
u64 changed) u64 changed)
{ {
struct mt792x_phy *phy = mt7921_hw_phy(hw); struct mt792x_phy *phy = mt7921_hw_phy(hw);
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
mt792x_mutex_acquire(dev); mt792x_mutex_acquire(dev);
...@@ -869,7 +869,7 @@ static void mt7921_tx(struct ieee80211_hw *hw, ...@@ -869,7 +869,7 @@ static void mt7921_tx(struct ieee80211_hw *hw,
struct ieee80211_tx_control *control, struct ieee80211_tx_control *control,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt76_phy *mphy = hw->priv; struct mt76_phy *mphy = hw->priv;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_vif *vif = info->control.vif; struct ieee80211_vif *vif = info->control.vif;
...@@ -907,7 +907,7 @@ static void mt7921_tx(struct ieee80211_hw *hw, ...@@ -907,7 +907,7 @@ static void mt7921_tx(struct ieee80211_hw *hw,
static int mt7921_set_rts_threshold(struct ieee80211_hw *hw, u32 val) static int mt7921_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
mt792x_mutex_acquire(dev); mt792x_mutex_acquire(dev);
mt76_connac_mcu_set_rts_thresh(&dev->mt76, val, 0); mt76_connac_mcu_set_rts_thresh(&dev->mt76, val, 0);
...@@ -921,7 +921,7 @@ mt7921_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -921,7 +921,7 @@ mt7921_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_ampdu_params *params) struct ieee80211_ampdu_params *params)
{ {
enum ieee80211_ampdu_mlme_action action = params->action; enum ieee80211_ampdu_mlme_action action = params->action;
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct ieee80211_sta *sta = params->sta; struct ieee80211_sta *sta = params->sta;
struct ieee80211_txq *txq = sta->txq[params->tid]; struct ieee80211_txq *txq = sta->txq[params->tid];
struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
...@@ -979,7 +979,7 @@ static int mt7921_sta_state(struct ieee80211_hw *hw, ...@@ -979,7 +979,7 @@ static int mt7921_sta_state(struct ieee80211_hw *hw,
enum ieee80211_sta_state old_state, enum ieee80211_sta_state old_state,
enum ieee80211_sta_state new_state) enum ieee80211_sta_state new_state)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
if (dev->pm.ds_enable) { if (dev->pm.ds_enable) {
mt792x_mutex_acquire(dev); mt792x_mutex_acquire(dev);
...@@ -1087,7 +1087,7 @@ static void ...@@ -1087,7 +1087,7 @@ static void
mt7921_get_et_strings(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mt7921_get_et_strings(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 sset, u8 *data) u32 sset, u8 *data)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
if (sset != ETH_SS_STATS) if (sset != ETH_SS_STATS)
return; return;
...@@ -1105,7 +1105,7 @@ static int ...@@ -1105,7 +1105,7 @@ static int
mt7921_get_et_sset_count(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mt7921_get_et_sset_count(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
int sset) int sset)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
if (sset != ETH_SS_STATS) if (sset != ETH_SS_STATS)
return 0; return 0;
...@@ -1204,7 +1204,7 @@ static u64 ...@@ -1204,7 +1204,7 @@ static u64
mt7921_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mt7921_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{ {
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
u8 omac_idx = mvif->mt76.omac_idx; u8 omac_idx = mvif->mt76.omac_idx;
union { union {
u64 t64; u64 t64;
...@@ -1230,7 +1230,7 @@ mt7921_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -1230,7 +1230,7 @@ mt7921_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u64 timestamp) u64 timestamp)
{ {
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
u8 omac_idx = mvif->mt76.omac_idx; u8 omac_idx = mvif->mt76.omac_idx;
union { union {
u64 t64; u64 t64;
...@@ -1298,7 +1298,7 @@ static int ...@@ -1298,7 +1298,7 @@ static int
mt7921_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mt7921_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_scan_request *req) struct ieee80211_scan_request *req)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt76_phy *mphy = hw->priv; struct mt76_phy *mphy = hw->priv;
int err; int err;
...@@ -1312,7 +1312,7 @@ mt7921_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -1312,7 +1312,7 @@ mt7921_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
static void static void
mt7921_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mt7921_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt76_phy *mphy = hw->priv; struct mt76_phy *mphy = hw->priv;
mt792x_mutex_acquire(dev); mt792x_mutex_acquire(dev);
...@@ -1325,7 +1325,7 @@ mt7921_start_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -1325,7 +1325,7 @@ mt7921_start_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct cfg80211_sched_scan_request *req, struct cfg80211_sched_scan_request *req,
struct ieee80211_scan_ies *ies) struct ieee80211_scan_ies *ies)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt76_phy *mphy = hw->priv; struct mt76_phy *mphy = hw->priv;
int err; int err;
...@@ -1345,7 +1345,7 @@ mt7921_start_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -1345,7 +1345,7 @@ mt7921_start_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
static int static int
mt7921_stop_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mt7921_stop_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt76_phy *mphy = hw->priv; struct mt76_phy *mphy = hw->priv;
int err; int err;
...@@ -1359,7 +1359,7 @@ mt7921_stop_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ...@@ -1359,7 +1359,7 @@ mt7921_stop_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
static int static int
mt7921_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) mt7921_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt792x_phy *phy = mt7921_hw_phy(hw); struct mt792x_phy *phy = mt7921_hw_phy(hw);
int max_nss = hweight8(hw->wiphy->available_antennas_tx); int max_nss = hweight8(hw->wiphy->available_antennas_tx);
...@@ -1423,7 +1423,7 @@ static void mt7921_sta_statistics(struct ieee80211_hw *hw, ...@@ -1423,7 +1423,7 @@ static void mt7921_sta_statistics(struct ieee80211_hw *hw,
static int mt7921_suspend(struct ieee80211_hw *hw, static int mt7921_suspend(struct ieee80211_hw *hw,
struct cfg80211_wowlan *wowlan) struct cfg80211_wowlan *wowlan)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt792x_phy *phy = mt7921_hw_phy(hw); struct mt792x_phy *phy = mt7921_hw_phy(hw);
cancel_delayed_work_sync(&phy->scan_work); cancel_delayed_work_sync(&phy->scan_work);
...@@ -1447,7 +1447,7 @@ static int mt7921_suspend(struct ieee80211_hw *hw, ...@@ -1447,7 +1447,7 @@ static int mt7921_suspend(struct ieee80211_hw *hw,
static int mt7921_resume(struct ieee80211_hw *hw) static int mt7921_resume(struct ieee80211_hw *hw)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt792x_phy *phy = mt7921_hw_phy(hw); struct mt792x_phy *phy = mt7921_hw_phy(hw);
mt792x_mutex_acquire(dev); mt792x_mutex_acquire(dev);
...@@ -1468,7 +1468,7 @@ static int mt7921_resume(struct ieee80211_hw *hw) ...@@ -1468,7 +1468,7 @@ static int mt7921_resume(struct ieee80211_hw *hw)
static void mt7921_set_wakeup(struct ieee80211_hw *hw, bool enabled) static void mt7921_set_wakeup(struct ieee80211_hw *hw, bool enabled)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt76_dev *mdev = &dev->mt76; struct mt76_dev *mdev = &dev->mt76;
device_set_wakeup_enable(mdev->dev, enabled); device_set_wakeup_enable(mdev->dev, enabled);
...@@ -1478,7 +1478,7 @@ static void mt7921_set_rekey_data(struct ieee80211_hw *hw, ...@@ -1478,7 +1478,7 @@ static void mt7921_set_rekey_data(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct cfg80211_gtk_rekey_data *data) struct cfg80211_gtk_rekey_data *data)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
mt792x_mutex_acquire(dev); mt792x_mutex_acquire(dev);
mt76_connac_mcu_update_gtk_rekey(hw, vif, data); mt76_connac_mcu_update_gtk_rekey(hw, vif, data);
...@@ -1489,7 +1489,7 @@ static void mt7921_set_rekey_data(struct ieee80211_hw *hw, ...@@ -1489,7 +1489,7 @@ static void mt7921_set_rekey_data(struct ieee80211_hw *hw,
static void mt7921_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, static void mt7921_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop) u32 queues, bool drop)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
wait_event_timeout(dev->mt76.tx_wait, !mt76_has_tx_pending(&dev->mphy), wait_event_timeout(dev->mt76.tx_wait, !mt76_has_tx_pending(&dev->mphy),
HZ / 2); HZ / 2);
...@@ -1501,7 +1501,7 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw, ...@@ -1501,7 +1501,7 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw,
bool enabled) bool enabled)
{ {
struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
mt792x_mutex_acquire(dev); mt792x_mutex_acquire(dev);
...@@ -1598,7 +1598,7 @@ int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw, ...@@ -1598,7 +1598,7 @@ int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw,
static int mt7921_set_sar_specs(struct ieee80211_hw *hw, static int mt7921_set_sar_specs(struct ieee80211_hw *hw,
const struct cfg80211_sar_specs *sar) const struct cfg80211_sar_specs *sar)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
int err; int err;
mt792x_mutex_acquire(dev); mt792x_mutex_acquire(dev);
...@@ -1619,7 +1619,7 @@ mt7921_channel_switch_beacon(struct ieee80211_hw *hw, ...@@ -1619,7 +1619,7 @@ mt7921_channel_switch_beacon(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct cfg80211_chan_def *chandef) struct cfg80211_chan_def *chandef)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
mt792x_mutex_acquire(dev); mt792x_mutex_acquire(dev);
mt7921_mcu_uni_add_beacon_offload(dev, hw, vif, true); mt7921_mcu_uni_add_beacon_offload(dev, hw, vif, true);
...@@ -1632,7 +1632,7 @@ mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -1632,7 +1632,7 @@ mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
{ {
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_phy *phy = mt7921_hw_phy(hw); struct mt792x_phy *phy = mt7921_hw_phy(hw);
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
int err; int err;
mt792x_mutex_acquire(dev); mt792x_mutex_acquire(dev);
...@@ -1660,7 +1660,7 @@ mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -1660,7 +1660,7 @@ mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
{ {
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_phy *phy = mt7921_hw_phy(hw); struct mt792x_phy *phy = mt7921_hw_phy(hw);
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
int err; int err;
mt792x_mutex_acquire(dev); mt792x_mutex_acquire(dev);
...@@ -1725,7 +1725,7 @@ mt7921_assign_vif_chanctx(struct ieee80211_hw *hw, ...@@ -1725,7 +1725,7 @@ mt7921_assign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_chanctx_conf *ctx) struct ieee80211_chanctx_conf *ctx)
{ {
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
mutex_lock(&dev->mt76.mutex); mutex_lock(&dev->mt76.mutex);
mvif->ctx = ctx; mvif->ctx = ctx;
...@@ -1741,7 +1741,7 @@ mt7921_unassign_vif_chanctx(struct ieee80211_hw *hw, ...@@ -1741,7 +1741,7 @@ mt7921_unassign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_chanctx_conf *ctx) struct ieee80211_chanctx_conf *ctx)
{ {
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
mutex_lock(&dev->mt76.mutex); mutex_lock(&dev->mt76.mutex);
mvif->ctx = NULL; mvif->ctx = NULL;
...@@ -1753,7 +1753,7 @@ static void mt7921_mgd_prepare_tx(struct ieee80211_hw *hw, ...@@ -1753,7 +1753,7 @@ static void mt7921_mgd_prepare_tx(struct ieee80211_hw *hw,
struct ieee80211_prep_tx_info *info) struct ieee80211_prep_tx_info *info)
{ {
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
u16 duration = info->duration ? info->duration : u16 duration = info->duration ? info->duration :
jiffies_to_msecs(HZ); jiffies_to_msecs(HZ);
......
...@@ -216,14 +216,6 @@ mt7921_hw_phy(struct ieee80211_hw *hw) ...@@ -216,14 +216,6 @@ mt7921_hw_phy(struct ieee80211_hw *hw)
return phy->priv; return phy->priv;
} }
static inline struct mt792x_dev *
mt7921_hw_dev(struct ieee80211_hw *hw)
{
struct mt76_phy *phy = hw->priv;
return container_of(phy->dev, struct mt792x_dev, mt76);
}
extern const struct ieee80211_ops mt7921_ops; extern const struct ieee80211_ops mt7921_ops;
u32 mt7921_reg_map(struct mt792x_dev *dev, u32 addr); u32 mt7921_reg_map(struct mt792x_dev *dev, u32 addr);
......
...@@ -157,7 +157,7 @@ static int mt7921u_mcu_init(struct mt792x_dev *dev) ...@@ -157,7 +157,7 @@ static int mt7921u_mcu_init(struct mt792x_dev *dev)
static void mt7921u_stop(struct ieee80211_hw *hw) static void mt7921u_stop(struct ieee80211_hw *hw)
{ {
struct mt792x_dev *dev = mt7921_hw_dev(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw);
mt76u_stop_tx(&dev->mt76); mt76u_stop_tx(&dev->mt76);
mt7921_stop(hw); mt7921_stop(hw);
......
...@@ -126,6 +126,14 @@ struct mt792x_dev { ...@@ -126,6 +126,14 @@ struct mt792x_dev {
u32 backup_l2; u32 backup_l2;
}; };
static inline struct mt792x_dev *
mt792x_hw_dev(struct ieee80211_hw *hw)
{
struct mt76_phy *phy = hw->priv;
return container_of(phy->dev, struct mt792x_dev, mt76);
}
#define mt792x_mutex_acquire(dev) \ #define mt792x_mutex_acquire(dev) \
mt76_connac_mutex_acquire(&(dev)->mt76, &(dev)->pm) mt76_connac_mutex_acquire(&(dev)->mt76, &(dev)->pm)
#define mt792x_mutex_release(dev) \ #define mt792x_mutex_release(dev) \
......
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