From: Gabor Juhos <juhosg@openwrt.org>
To: Gertjan van Wingerde <gwingerde@gmail.com>
Cc: John Linville <linville@tuxdriver.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"users@rt2x00.serialmonkey.com" <users@rt2x00.serialmonkey.com>
Subject: Re: [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary PAs/LNAs for 3T/3R devices
Date: Mon, 24 Jun 2013 21:17:58 +0200 [thread overview]
Message-ID: <51C89B66.8010509@openwrt.org> (raw)
In-Reply-To: <3B42FB1E-C6CE-4580-9C71-47BB609B4CB8@gmail.com>
Hi Gertjan,
> Sent from my iPad
>
> On 22 jun. 2013, at 17:42, Gabor Juhos <juhosg@openwrt.org> wrote:
>
>> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
>> ---
>> drivers/net/wireless/rt2x00/rt2800lib.c | 14 ++++++++++++++
>> 1 file changed, 14 insertions(+)
>>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
>> index f4cd3d8..664e9e1 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
>> @@ -2684,12 +2684,26 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
>> rf->channel > 14);
>> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN,
>> rf->channel <= 14);
>> +
>> + if (rt2x00dev->default_ant.tx_chain_num > 2) {
>> + /* Turn on tertiary PAs for 3T devices */
>> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A2_EN,
>> + rf->channel > 14);
>> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G2_EN,
>> + rf->channel <= 14);
>> + }
>> }
>>
>> if (rt2x00dev->default_ant.rx_chain_num > 1) {
>> /* Turn on secondary LNAs for 2R and for 3R devices */
>> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1);
>> rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1);
>> +
>> + if (rt2x00dev->default_ant.rx_chain_num > 2) {
>> + /* Turn on tertiary LNAs for 3R devices */
>> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN, 1);
>> + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN, 1);
>> + }
>> }
>
> Stylistic I would prefer the if outside of if block you included it in.
> Something like:
>
> if (tx_chain_num > 2) {
> /* Turn on tertiary PAs for 3T devices */
> }
> if (tx_chain_num > 1) {
> /* Turn on secondary PAs for 2T and for 3T devices */
> }
> /* Turn on primary PAs for 1T, 2T and for 3T devices */
> At least to me this is easier to read.
Yes it would be more readable. The only disadvantage of separated if statements
is that both conditions will be evaluated on 1T devices.
> Alternatively it could be changed to a switch statement wit fall-through
> cases for the number of RX/TX streams.
This sounds more reasonable, I will change the code to use switch statements.
Thanks,
Gabor
next prev parent reply other threads:[~2013-06-24 19:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-22 15:42 [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support Gabor Juhos
2013-06-22 15:42 ` [PATCH 1/3] rt2x00: rt2800: increase EEPROM_SIZE to 512 bytes Gabor Juhos
2013-06-24 13:01 ` Helmut Schaa
2013-06-24 17:32 ` Gertjan van Wingerde
2013-06-22 15:42 ` [PATCH 2/3] rt2x00: rt2800lib: turn on secondary PAs/LNAs for 3T/3R devices Gabor Juhos
2013-06-24 13:00 ` Helmut Schaa
2013-06-24 19:00 ` Gabor Juhos
2013-06-24 17:33 ` Gertjan van Wingerde
2013-06-22 15:42 ` [PATCH 3/3] rt2x00: rt2800lib: turn on tertiary " Gabor Juhos
2013-06-24 13:02 ` Helmut Schaa
2013-06-24 17:42 ` Gertjan van Wingerde
2013-06-24 19:17 ` Gabor Juhos [this message]
2013-06-24 16:00 ` [rt2x00-users] [PATCH 0/3] rt2x00: rt2800: prepare for three-chain device support Stanislaw Gruszka
2013-06-24 19:09 ` Gabor Juhos
2013-06-25 19:18 ` Stanislaw Gruszka
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=51C89B66.8010509@openwrt.org \
--to=juhosg@openwrt.org \
--cc=gwingerde@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=users@rt2x00.serialmonkey.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;
as well as URLs for NNTP newsgroup(s).