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: John Walker <john@x109.net> Signed-off-by: Chaitanya T K <chaitanya.mgit@gmail.com> Acked-by: John W. Linville <linville@tuxdriver.com> [remove unneeded parentheses, fix rounding by using %.0f] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
c7d37a66e3
commit
a9fb54169b
@ -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
|
||||
}
|
||||
@ -117,7 +107,7 @@ function parse_reg_rule()
|
||||
|
||||
}
|
||||
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++
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user