All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis R. Rodriguez <lrodriguez@atheros.com>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH]: ath9k: fix bug in tx power
Date: Thu, 2 Dec 2010 15:51:55 -0800	[thread overview]
Message-ID: <20101202235155.GN7399@tux> (raw)
In-Reply-To: <AANLkTinY5Ook3Jk=P8KW34djuAzK1sVJgPds9mZkU4sk@mail.gmail.com>

On Thu, Dec 02, 2010 at 03:39:49PM -0800, Matteo Croce wrote:
> The ath9k driver subtracts 3 dBm to the txpower as with two radios the
> signal power is doubled.
> The resulting value is assigned in an u16 which overflows and makes
> the card work at full power.

Sorry can you also add:

Cc: stable at kernel.org

Right above your Signed-off-by, this is a regulatory fix,
thanks.
 
  Luis
> 
> Signed-off-by: Matteo Croce <matteo@openwrt.org>
> 
> --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c	2010-12-02
> 22:39:58.982020001 +0100
> +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c	2010-12-03
> 00:36:23.637799002 +0100
> @@ -1065,15 +1065,19 @@
>  	case 1:
>  		break;
>  	case 2:
> -		scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
> +		if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN)
> +			scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
> +		else
> +			scaledPower = 0;
>  		break;
>  	case 3:
> -		scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
> +		if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN)
> +			scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
> +		else
> +			scaledPower = 0;
>  		break;
>  	}
> 
> -	scaledPower = max((u16)0, scaledPower);
> -
>  	if (IS_CHAN_2GHZ(chan)) {
>  		numCtlModes = ARRAY_SIZE(ctlModesFor11g) -
>  			SUB_NUM_CTL_MODES_AT_2G_40;
> _______________________________________________
> ath9k-devel mailing list
> ath9k-devel at lists.ath9k.org
> https://lists.ath9k.org/mailman/listinfo/ath9k-devel

WARNING: multiple messages have this Message-ID (diff)
From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: Matteo Croce <technoboy85@gmail.com>
Cc: "Luis R. Rodriguez" <mcgrof@gmail.com>,
	"ath9k-devel@lists.ath9k.org" <ath9k-devel@lists.ath9k.org>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"John W. Linville" <linville@tuxdriver.com>
Subject: Re: [ath9k-devel] [PATCH]: ath9k: fix bug in tx power
Date: Thu, 2 Dec 2010 15:51:55 -0800	[thread overview]
Message-ID: <20101202235155.GN7399@tux> (raw)
In-Reply-To: <AANLkTinY5Ook3Jk=P8KW34djuAzK1sVJgPds9mZkU4sk@mail.gmail.com>

On Thu, Dec 02, 2010 at 03:39:49PM -0800, Matteo Croce wrote:
> The ath9k driver subtracts 3 dBm to the txpower as with two radios the
> signal power is doubled.
> The resulting value is assigned in an u16 which overflows and makes
> the card work at full power.

Sorry can you also add:

Cc: stable@kernel.org

Right above your Signed-off-by, this is a regulatory fix,
thanks.
 
  Luis
> 
> Signed-off-by: Matteo Croce <matteo@openwrt.org>
> 
> --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c	2010-12-02
> 22:39:58.982020001 +0100
> +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c	2010-12-03
> 00:36:23.637799002 +0100
> @@ -1065,15 +1065,19 @@
>  	case 1:
>  		break;
>  	case 2:
> -		scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
> +		if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN)
> +			scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
> +		else
> +			scaledPower = 0;
>  		break;
>  	case 3:
> -		scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
> +		if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN)
> +			scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
> +		else
> +			scaledPower = 0;
>  		break;
>  	}
> 
> -	scaledPower = max((u16)0, scaledPower);
> -
>  	if (IS_CHAN_2GHZ(chan)) {
>  		numCtlModes = ARRAY_SIZE(ctlModesFor11g) -
>  			SUB_NUM_CTL_MODES_AT_2G_40;
> _______________________________________________
> ath9k-devel mailing list
> ath9k-devel@lists.ath9k.org
> https://lists.ath9k.org/mailman/listinfo/ath9k-devel

  reply	other threads:[~2010-12-02 23:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02 23:24 [ath9k-devel] [PATCH]: ath9k: fix bug in tx power Matteo Croce
2010-12-02 23:24 ` Matteo Croce
2010-12-02 23:31 ` [ath9k-devel] " Luis R. Rodriguez
2010-12-02 23:31   ` Luis R. Rodriguez
2010-12-02 23:39   ` [ath9k-devel] " Matteo Croce
2010-12-02 23:39     ` Matteo Croce
2010-12-02 23:51     ` Luis R. Rodriguez [this message]
2010-12-02 23:51       ` [ath9k-devel] " Luis R. Rodriguez
2010-12-03  1:25       ` Matteo Croce
2010-12-03  1:25         ` Matteo Croce

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=20101202235155.GN7399@tux \
    --to=lrodriguez@atheros.com \
    --cc=ath9k-devel@lists.ath9k.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.