mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
wifi: mt76: mt7921: refactor regulatory notifier flow
Rename mt7921_regd_update() to mt7921_mcu_regd_update() to centralize regd updates with error handling. Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: JB Tsai <jb.tsai@mediatek.com> Link: https://patch.msgid.link/20260303053637.465465-3-jb.tsai@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
fbb493cd95
commit
e88098133e
|
|
@ -802,7 +802,7 @@ mt7921_regd_set_6ghz_power_type(struct ieee80211_vif *vif, bool is_add)
|
|||
|
||||
out:
|
||||
if (vif->bss_conf.chanreq.oper.chan->band == NL80211_BAND_6GHZ)
|
||||
mt7921_regd_update(dev);
|
||||
mt7921_mcu_regd_update(dev, dev->mt76.alpha2, dev->country_ie_env);
|
||||
}
|
||||
|
||||
int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
|
||||
|
|
|
|||
|
|
@ -589,7 +589,7 @@ static int mt7921_pci_resume(struct device *device)
|
|||
if (err < 0)
|
||||
goto failed;
|
||||
|
||||
mt7921_regd_update(dev);
|
||||
mt7921_mcu_regd_update(dev, mdev->alpha2, dev->country_ie_env);
|
||||
err = mt7921_mcu_radio_led_ctrl(dev, EXT_CMD_RADIO_ON_LED);
|
||||
failed:
|
||||
pm->suspended = false;
|
||||
|
|
|
|||
|
|
@ -71,18 +71,43 @@ mt7921_regd_channel_update(struct wiphy *wiphy, struct mt792x_dev *dev)
|
|||
}
|
||||
}
|
||||
|
||||
void mt7921_regd_update(struct mt792x_dev *dev)
|
||||
int mt7921_mcu_regd_update(struct mt792x_dev *dev, u8 *alpha2,
|
||||
enum environment_cap country_ie_env)
|
||||
{
|
||||
struct mt76_dev *mdev = &dev->mt76;
|
||||
struct ieee80211_hw *hw = mdev->hw;
|
||||
struct wiphy *wiphy = hw->wiphy;
|
||||
int ret = 0;
|
||||
|
||||
dev->regd_in_progress = true;
|
||||
|
||||
mt792x_mutex_acquire(dev);
|
||||
if (!dev->regd_change)
|
||||
goto err;
|
||||
|
||||
ret = mt7921_mcu_set_clc(dev, alpha2, country_ie_env);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
mt7921_mcu_set_clc(dev, mdev->alpha2, dev->country_ie_env);
|
||||
mt7921_regd_channel_update(wiphy, dev);
|
||||
mt76_connac_mcu_set_channel_domain(hw->priv);
|
||||
mt7921_set_tx_sar_pwr(hw, NULL);
|
||||
|
||||
ret = mt76_connac_mcu_set_channel_domain(hw->priv);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
ret = mt7921_set_tx_sar_pwr(hw, NULL);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
err:
|
||||
mt792x_mutex_release(dev);
|
||||
dev->regd_change = false;
|
||||
dev->regd_in_progress = false;
|
||||
wake_up(&dev->wait);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt7921_regd_update);
|
||||
EXPORT_SYMBOL_GPL(mt7921_mcu_regd_update);
|
||||
|
||||
void mt7921_regd_notifier(struct wiphy *wiphy,
|
||||
struct regulatory_request *request)
|
||||
|
|
@ -105,12 +130,6 @@ void mt7921_regd_notifier(struct wiphy *wiphy,
|
|||
if (pm->suspended)
|
||||
return;
|
||||
|
||||
dev->regd_in_progress = true;
|
||||
|
||||
mt792x_mutex_acquire(dev);
|
||||
mt7921_regd_update(dev);
|
||||
mt792x_mutex_release(dev);
|
||||
|
||||
dev->regd_in_progress = false;
|
||||
wake_up(&dev->wait);
|
||||
mt7921_mcu_regd_update(dev, request->alpha2,
|
||||
request->country_ie_env);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ struct mt792x_dev;
|
|||
struct wiphy;
|
||||
struct regulatory_request;
|
||||
|
||||
void mt7921_regd_update(struct mt792x_dev *dev);
|
||||
int mt7921_mcu_regd_update(struct mt792x_dev *dev, u8 *alpha2,
|
||||
enum environment_cap country_ie_env);
|
||||
void mt7921_regd_notifier(struct wiphy *wiphy,
|
||||
struct regulatory_request *request);
|
||||
bool mt7921_regd_clc_supported(struct mt792x_dev *dev);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user