@@ -15,13 +15,15 @@
#include "hif_tx.h"
#include "hif_api_mib.h"
-static inline int hif_set_output_power(struct wfx_vif *wvif, int power_level)
+static inline int hif_set_output_power(struct wfx_vif *wvif, int val)
{
- __le32 val = cpu_to_le32(power_level);
+ struct hif_mib_current_tx_power_level arg = {
+ .power_level = cpu_to_le32(val * 10),
+ };
return hif_write_mib(wvif->wdev, wvif->id,
HIF_MIB_ID_CURRENT_TX_POWER_LEVEL,
- &val, sizeof(val));
+ &arg, sizeof(arg));
}
static inline int hif_set_beacon_wakeup_period(struct wfx_vif *wvif,
@@ -61,7 +61,7 @@ static int send_scan_req(struct wfx_vif *wvif,
return timeout;
ret = wait_for_completion_timeout(&wvif->scan_complete, timeout);
if (req->channels[start_idx]->max_power != wvif->wdev->output_power)
- hif_set_output_power(wvif, wvif->wdev->output_power * 10);
+ hif_set_output_power(wvif, wvif->wdev->output_power);
wfx_tx_unlock(wvif->wdev);
if (!ret) {
dev_notice(wvif->wdev->dev, "scan timeout\n");
@@ -503,7 +503,7 @@ static void wfx_do_unjoin(struct wfx_vif *wvif)
hif_keep_alive_period(wvif, 0);
hif_reset(wvif, false);
wfx_tx_policy_init(wvif);
- hif_set_output_power(wvif, wvif->wdev->output_power * 10);
+ hif_set_output_power(wvif, wvif->wdev->output_power);
wvif->dtim_period = 0;
hif_set_macaddr(wvif, wvif->vif->addr);
wfx_free_event_queue(wvif);
@@ -1063,7 +1063,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw,
if (changed & BSS_CHANGED_TXPOWER &&
info->txpower != wdev->output_power) {
wdev->output_power = info->txpower;
- hif_set_output_power(wvif, wdev->output_power * 10);
+ hif_set_output_power(wvif, wdev->output_power);
}
mutex_unlock(&wdev->conf_mutex);
@@ -1317,7 +1317,7 @@ int wfx_config(struct ieee80211_hw *hw, u32 changed)
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 * 10);
+ hif_set_output_power(wvif, wdev->output_power);
}
if (changed & IEEE80211_CONF_CHANGE_PS) {