mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Reto Schneider <code@reto-schneider.ch>,
	Jes.Sorensen@gmail.com, linux-wireless@vger.kernel.org,
	pkshih@realtek.com
Cc: yhchuang@realtek.com, Larry.Finger@lwfinger.net,
	tehuang@realtek.com, reto.schneider@husqvarnagroup.com,
	ccchiu77@gmail.com, kvalo@codeaurora.org, davem@davemloft.net,
	kuba@kernel.org, Chris Chiu <chiu@endlessos.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 2/7] rtl8xxxu: add handle for mac80211 get_txpower
Date: Thu, 13 May 2021 21:22:09 -0700	[thread overview]
Message-ID: <d1ae6de53236629d2d02bed1af280e1cbf4c4e8c.camel@perches.com> (raw)
In-Reply-To: <20210514020442.946-3-code@reto-schneider.ch>

On Fri, 2021-05-14 at 04:04 +0200, Reto Schneider wrote:
> From: Chris Chiu <chiu@endlessos.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);



  reply	other threads:[~2021-05-14  4:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a31d9500-73a3-f890-bebd-d0a4014f87da@reto-schneider.ch>
2021-05-14  2:04 ` [PATCH 0/7] [RFC] rtl8xxxu/RTL8188CUS: Wi-Fi Alliance Certification Reto Schneider
2021-05-14  2:04   ` [PATCH 1/7] rtl8xxxu: add code to handle BSS_CHANGED_TXPOWER/IEEE80211_CONF_CHANGE_POWER Reto Schneider
2021-05-14  4:09     ` Joe Perches
2021-05-14  2:04   ` [PATCH 2/7] rtl8xxxu: add handle for mac80211 get_txpower Reto Schneider
2021-05-14  4:22     ` Joe Perches [this message]
2021-05-14  2:04   ` [PATCH 3/7] rtl8xxxu: Enable RX STBC by default Reto Schneider
2021-05-14  2:04   ` [PATCH 4/7] rtl8xxxu: feed antenna information for mac80211 Reto Schneider
2021-05-14  2:04   ` [PATCH 5/7] rtl8xxxu: fill up txrate info for all chips Reto Schneider
2021-05-14  2:04   ` [PATCH 6/7] rtl8xxxu: Fix the reported rx signal strength Reto Schneider
2021-05-14  2:04   ` [PATCH 7/7] rtl8xxxu: Fix ampdu_action to get block ack session work Reto Schneider

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d1ae6de53236629d2d02bed1af280e1cbf4c4e8c.camel@perches.com \
    --to=joe@perches.com \
    --cc=Jes.Sorensen@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=ccchiu77@gmail.com \
    --cc=chiu@endlessos.org \
    --cc=code@reto-schneider.ch \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pkshih@realtek.com \
    --cc=reto.schneider@husqvarnagroup.com \
    --cc=tehuang@realtek.com \
    --cc=yhchuang@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®