Commit f050f3da authored by Jérôme Pouiller's avatar Jérôme Pouiller Committed by Greg Kroah-Hartman

staging: wfx: drop wdev->output_power

mac80211 and the device are both able to control tx power per vif. But,
the current code retrieve tx power from wfx_config(). So, it does not
allow to setup the tx power independently for each vif. Driver just has
to rely on bss_conf->txpower to get the correct information.

In add, it is no more necessary to protect access to wdev->output_power
with scan_lock.
Signed-off-by: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-15-Jerome.Pouiller@silabs.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 811ed3e2
...@@ -60,8 +60,8 @@ static int send_scan_req(struct wfx_vif *wvif, ...@@ -60,8 +60,8 @@ static int send_scan_req(struct wfx_vif *wvif,
if (timeout < 0) if (timeout < 0)
return timeout; return timeout;
ret = wait_for_completion_timeout(&wvif->scan_complete, timeout); ret = wait_for_completion_timeout(&wvif->scan_complete, timeout);
if (req->channels[start_idx]->max_power != wvif->wdev->output_power) if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower)
hif_set_output_power(wvif, wvif->wdev->output_power); hif_set_output_power(wvif, wvif->vif->bss_conf.txpower);
wfx_tx_unlock(wvif->wdev); wfx_tx_unlock(wvif->wdev);
if (!ret) { if (!ret) {
dev_notice(wvif->wdev->dev, "scan timeout\n"); dev_notice(wvif->wdev->dev, "scan timeout\n");
......
...@@ -503,7 +503,6 @@ static void wfx_do_unjoin(struct wfx_vif *wvif) ...@@ -503,7 +503,6 @@ static void wfx_do_unjoin(struct wfx_vif *wvif)
hif_keep_alive_period(wvif, 0); hif_keep_alive_period(wvif, 0);
hif_reset(wvif, false); hif_reset(wvif, false);
wfx_tx_policy_init(wvif); wfx_tx_policy_init(wvif);
hif_set_output_power(wvif, wvif->wdev->output_power);
wvif->dtim_period = 0; wvif->dtim_period = 0;
hif_set_macaddr(wvif, wvif->vif->addr); hif_set_macaddr(wvif, wvif->vif->addr);
wfx_free_event_queue(wvif); wfx_free_event_queue(wvif);
...@@ -990,11 +989,8 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, ...@@ -990,11 +989,8 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw,
info->cqm_rssi_hyst); info->cqm_rssi_hyst);
} }
if (changed & BSS_CHANGED_TXPOWER && if (changed & BSS_CHANGED_TXPOWER)
info->txpower != wdev->output_power) { hif_set_output_power(wvif, info->txpower);
wdev->output_power = info->txpower;
hif_set_output_power(wvif, wdev->output_power);
}
mutex_unlock(&wdev->conf_mutex); mutex_unlock(&wdev->conf_mutex);
if (do_join) if (do_join)
...@@ -1232,7 +1228,6 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed) ...@@ -1232,7 +1228,6 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed)
{ {
int ret = 0; int ret = 0;
struct wfx_dev *wdev = hw->priv; struct wfx_dev *wdev = hw->priv;
struct ieee80211_conf *conf = &hw->conf;
struct wfx_vif *wvif; struct wfx_vif *wvif;
// FIXME: Interface id should not been hardcoded // FIXME: Interface id should not been hardcoded
...@@ -1242,13 +1237,7 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed) ...@@ -1242,13 +1237,7 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed)
return 0; return 0;
} }
mutex_lock(&wvif->scan_lock);
mutex_lock(&wdev->conf_mutex); mutex_lock(&wdev->conf_mutex);
if (changed & IEEE80211_CONF_CHANGE_POWER) {
wdev->output_power = conf->power_level;
hif_set_output_power(wvif, wdev->output_power);
}
if (changed & IEEE80211_CONF_CHANGE_PS) { if (changed & IEEE80211_CONF_CHANGE_PS) {
wvif = NULL; wvif = NULL;
while ((wvif = wvif_iterate(wdev, wvif)) != NULL) while ((wvif = wvif_iterate(wdev, wvif)) != NULL)
...@@ -1257,7 +1246,6 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed) ...@@ -1257,7 +1246,6 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed)
} }
mutex_unlock(&wdev->conf_mutex); mutex_unlock(&wdev->conf_mutex);
mutex_unlock(&wvif->scan_lock);
return ret; return ret;
} }
......
...@@ -59,8 +59,6 @@ struct wfx_dev { ...@@ -59,8 +59,6 @@ struct wfx_dev {
struct hif_rx_stats rx_stats; struct hif_rx_stats rx_stats;
struct mutex rx_stats_lock; struct mutex rx_stats_lock;
int output_power;
}; };
struct wfx_vif { struct wfx_vif {
......
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