[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d1ae6de53236629d2d02bed1af280e1cbf4c4e8c.camel@perches.com>
Date: Thu, 13 May 2021 21:22:09 -0700
From: Joe Perches <joe@...ches.com>
To: Reto Schneider <code@...o-schneider.ch>, Jes.Sorensen@...il.com,
linux-wireless@...r.kernel.org, pkshih@...ltek.com
Cc: yhchuang@...ltek.com, Larry.Finger@...inger.net,
tehuang@...ltek.com, reto.schneider@...qvarnagroup.com,
ccchiu77@...il.com, kvalo@...eaurora.org, davem@...emloft.net,
kuba@...nel.org, Chris Chiu <chiu@...lessos.org>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH 2/7] rtl8xxxu: add handle for mac80211 get_txpower
On Fri, 2021-05-14 at 04:04 +0200, Reto Schneider wrote:
> From: Chris Chiu <chiu@...lessos.org>
>
> add .get_txpower handle for mac80211 operations for `iw` and `wext`
> tools to get the underlying tx power (max limit).
[]
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
[]
> +int
> +rtl8xxxu_gen1_get_tx_power(struct rtl8xxxu_priv *priv)
> +{
> + u8 txpwr_level;
> + int txpwr_dbm;
> +
> + txpwr_level = priv->cur_cck_txpwridx;
> + txpwr_dbm = rtl8xxxu_gen1_txpwridx_to_dbm(priv, WIRELESS_MODE_B,
> + txpwr_level);
> + txpwr_level = priv->cur_ofdm24g_txpwridx +
> + priv->ofdm_tx_power_index_diff[1].a;
> +
> + if (rtl8xxxu_gen1_txpwridx_to_dbm(priv, WIRELESS_MODE_G, txpwr_level)
> + > txpwr_dbm)
> + txpwr_dbm = rtl8xxxu_gen1_txpwridx_to_dbm(priv, WIRELESS_MODE_G,
> + txpwr_level);
probably better to use a temporaries instead of multiple calls.
foo = rtl8xxxu_gen1_txpwridx_to_dbm(priv, WIRELESS_MODE_G, txpwr_level);
if (foo > txpwr_dbm)
txpwr_dbm = foo;
> + txpwr_level = priv->cur_ofdm24g_txpwridx;
> + if (rtl8xxxu_gen1_txpwridx_to_dbm(priv, WIRELESS_MODE_N_24G,
> + txpwr_level) > txpwr_dbm)
> + txpwr_dbm = rtl8xxxu_gen1_txpwridx_to_dbm(priv,
> + WIRELESS_MODE_N_24G,
> + txpwr_level);
> +
> + return txpwr_dbm;
foo = rtl8xxxu_gen1_txpwridx_to_dbm(priv, WIRELESS_MODE_N_24G, txpwr_level);
return min(txpwr_dbm, foo);
Powered by blists - more mailing lists