Commit a9fb5416 authored by chaitanya.mgit@gmail.com's avatar chaitanya.mgit@gmail.com Committed by Johannes Berg

regdb: Generalize the mW to dBm power conversion

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: default avatarJohn Walker <john@x109.net>
Signed-off-by: default avatarChaitanya T K <chaitanya.mgit@gmail.com>
Acked-by: default avatarJohn W. Linville <linville@tuxdriver.com>
[remove unneeded parentheses, fix rounding by using %.0f]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent c7d37a66
...@@ -68,17 +68,7 @@ function parse_reg_rule() ...@@ -68,17 +68,7 @@ function parse_reg_rule()
sub(/,/, "", units) sub(/,/, "", units)
dfs_cac = $9 dfs_cac = $9
if (units == "mW") { if (units == "mW") {
if (power == 100) { power = 10 * log(power)/log(10)
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!"
}
} else { } else {
dfs_cac = $8 dfs_cac = $8
} }
...@@ -117,7 +107,7 @@ function parse_reg_rule() ...@@ -117,7 +107,7 @@ function parse_reg_rule()
} }
flags = flags "0" flags = flags "0"
printf "\t\tREG_RULE_EXT(%d, %d, %d, %d, %d, %d, %s),\n", start, end, bw, gain, power, dfs_cac, flags printf "\t\tREG_RULE_EXT(%d, %d, %d, %d, %.0f, %d, %s),\n", start, end, bw, gain, power, dfs_cac, flags
rules++ rules++
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment