linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bruno Randolf <br1@einfach.org>
To: Bob Copeland <me@bobcopeland.com>
Cc: linville@tuxdriver.com, jirislaby@gmail.com, mickflemm@gmail.com,
	lrodriguez@atheros.com, linux-wireless@vger.kernel.org,
	ath5k-devel@lists.ath5k.org
Subject: Re: [PATCH 1/4] ath5k: correct channel setting for 2.5 mhz spacing
Date: Thu, 8 Apr 2010 13:14:41 +0900	[thread overview]
Message-ID: <201004081314.41703.br1@einfach.org> (raw)
In-Reply-To: <1270698959-7844-2-git-send-email-me@bobcopeland.com>

On Thursday 08 April 2010 12:55:56 Bob Copeland wrote:
> These channels aren't selectable anyway, but our calculations
> for 2.5 mhz frequencies are incorrect.  The value is supposed to
> be:
> 
>   (frequency - reference) * (10/25)
> 
> i.e., divide by 2.5, but we were instead doing:
> 
>   (10 * frequency - reference) / 25.
> 
> Additionally, the check for (frequency % 5 == 2) had an extra
> subtraction that wasn't in madwifi HAL.
> 
> Signed-off-by: Bob Copeland <me@bobcopeland.com>
> ---
>  drivers/net/wireless/ath/ath5k/phy.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath5k/phy.c
> b/drivers/net/wireless/ath/ath5k/phy.c index b83ca8a..81bdebd 100644
> --- a/drivers/net/wireless/ath/ath5k/phy.c
> +++ b/drivers/net/wireless/ath/ath5k/phy.c
> @@ -979,7 +979,7 @@ static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah,
>  			return -EINVAL;
> 
>  		data0 = ath5k_hw_bitswap((data0 << 2) & 0xff, 8);
> -	} else if ((c - (c % 5)) != 2 || c > 5435) {
> +	} else if ((c % 5) != 2 || c > 5435) {
>  		if (!(c % 20) && c >= 5120) {
>  			data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8);
>  			data2 = ath5k_hw_bitswap(3, 2);
> @@ -992,7 +992,7 @@ static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah,
>  		} else
>  			return -EINVAL;
>  	} else {
> -		data0 = ath5k_hw_bitswap((10 * (c - 2) - 4800) / 25 + 1, 8);
> +		data0 = ath5k_hw_bitswap((10 * (c - 2 - 4800)) / 25 + 1, 8);
>  		data2 = ath5k_hw_bitswap(0, 2);
>  	}
> 
> @@ -1020,7 +1020,7 @@ static int ath5k_hw_rf2425_channel(struct ath5k_hw
> *ah, data0 = ath5k_hw_bitswap((c - 2272), 8);
>  		data2 = 0;
>  	/* ? 5GHz ? */
> -	} else if ((c - (c % 5)) != 2 || c > 5435) {
> +	} else if ((c % 5) != 2 || c > 5435) {
>  		if (!(c % 20) && c < 5120)
>  			data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8);
>  		else if (!(c % 10))
> @@ -1031,7 +1031,7 @@ static int ath5k_hw_rf2425_channel(struct ath5k_hw
> *ah, return -EINVAL;
>  		data2 = ath5k_hw_bitswap(1, 2);
>  	} else {
> -		data0 = ath5k_hw_bitswap((10 * (c - 2) - 4800) / 25 + 1, 8);
> +		data0 = ath5k_hw_bitswap((10 * (c - 2 - 4800)) / 25 + 1, 8);
>  		data2 = ath5k_hw_bitswap(0, 2);
>  	}

for whatever it's worth :-)

Acked-by: Bruno Randolf <br1@einfach.org>

  reply	other threads:[~2010-04-08  4:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-08  3:55 [PATCH 0/4] ath5k: misc fixes Bob Copeland
2010-04-08  3:55 ` [PATCH 1/4] ath5k: correct channel setting for 2.5 mhz spacing Bob Copeland
2010-04-08  4:14   ` Bruno Randolf [this message]
2010-04-08  3:55 ` [PATCH 2/4] ath5k: clean up queue manipulation Bob Copeland
2010-04-08  4:15   ` Bruno Randolf
2010-04-08  3:55 ` [PATCH 3/4] ath5k: fix race condition in tx desc processing Bob Copeland
2010-04-08  4:15   ` Bruno Randolf
2010-04-08  3:55 ` [PATCH 4/4] ath5k: add bounds check to pdadc table Bob Copeland
2010-04-08  4:15   ` Bruno Randolf

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=201004081314.41703.br1@einfach.org \
    --to=br1@einfach.org \
    --cc=ath5k-devel@lists.ath5k.org \
    --cc=jirislaby@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=lrodriguez@atheros.com \
    --cc=me@bobcopeland.com \
    --cc=mickflemm@gmail.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).