All of lore.kernel.org
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: chaitanya.mgit@gmail.com
Cc: mcgrof@gmail.com, linux-wireless@vger.kernel.org
Subject: Re: [PATCH V2] regdb: Generalize the mW to dBm power conversion
Date: Tue, 27 May 2014 11:31:28 -0400	[thread overview]
Message-ID: <20140527153127.GC5694@tuxdriver.com> (raw)
In-Reply-To: <1401107504-11385-1-git-send-email-chaitanya.mgit@gmail.com>

On Mon, May 26, 2014 at 06:01:44PM +0530, chaitanya.mgit@gmail.com wrote:
> Generalize the power conversion from mW to dBm 
> using log. This should fix the below compilation
> error for country NO which adds a new power value
> 2000mW which is not handled earlier.
> 
>  CC [M]  net/wireless/wext-sme.o
>  CC [M]  net/wireless/regdb.o
> net/wireless/regdb.c:1130:1: error: Unknown undeclared here (not in
> a function)
> net/wireless/regdb.c:1130:9: error: expected } before power
> make[2]: *** [net/wireless/regdb.o] Error 1
> make[1]: *** [net/wireless] Error 2
> make: *** [net] Error 2
> 
> Reported-By:  John Walker <john@x109.net>
> Signed-off-by: Chaitanya T K <chaitanya.mgit@gmail.com>
> 
> ---
>  net/wireless/genregdb.awk |   12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/net/wireless/genregdb.awk b/net/wireless/genregdb.awk
> index 4119833..949ee38 100644
> --- a/net/wireless/genregdb.awk
> +++ b/net/wireless/genregdb.awk
> @@ -68,17 +68,7 @@ function parse_reg_rule()
>  	sub(/,/, "", units)
>  	dfs_cac = $9
>  	if (units == "mW") {
> -		if (power == 100) {
> -			power = 20
> -		} else if (power == 200) {
> -			power = 23
> -		} else if (power == 500) {
> -			power = 27
> -		} else if (power == 1000) {
> -			power = 30
> -		} else {
> -			print "Unknown power value in database!"
> -		}
> +		power = 10 * (log(power)/log(10))
>  	} else {
>  		dfs_cac = $8
>  	}

I'm not fond of the unnecessary parenthesis.  But otherwise it seems great.

Acked-by: John W. Linville <linville@tuxdriver.com>

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

  reply	other threads:[~2014-05-27 15:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-26 12:31 [PATCH V2] regdb: Generalize the mW to dBm power conversion chaitanya.mgit
2014-05-27 15:31 ` John W. Linville [this message]
2014-05-27 15:57 ` Johannes Berg
2014-05-27 16:11   ` Krishna Chaitanya
2014-05-27 16:42     ` Johannes Berg

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=20140527153127.GC5694@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=chaitanya.mgit@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mcgrof@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 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.