Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cfg80211: make use of reg macros on REG_RULE

Ensure regulatory converstion macros safely accept
multiple arguments and make REG_RULE() use them.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Luis R. Rodriguez and committed by
John W. Linville
b219cee1 9c96477d

+11 -11
+11 -11
include/net/cfg80211.h
··· 336 336 struct ieee80211_reg_rule reg_rules[]; 337 337 }; 338 338 339 - #define MHZ_TO_KHZ(freq) (freq * 1000) 340 - #define KHZ_TO_MHZ(freq) (freq / 1000) 341 - #define DBI_TO_MBI(gain) (gain * 100) 342 - #define MBI_TO_DBI(gain) (gain / 100) 343 - #define DBM_TO_MBM(gain) (gain * 100) 344 - #define MBM_TO_DBM(gain) (gain / 100) 339 + #define MHZ_TO_KHZ(freq) ((freq) * 1000) 340 + #define KHZ_TO_MHZ(freq) ((freq) / 1000) 341 + #define DBI_TO_MBI(gain) ((gain) * 100) 342 + #define MBI_TO_DBI(gain) ((gain) / 100) 343 + #define DBM_TO_MBM(gain) ((gain) * 100) 344 + #define MBM_TO_DBM(gain) ((gain) / 100) 345 345 346 346 #define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \ 347 - .freq_range.start_freq_khz = (start) * 1000, \ 348 - .freq_range.end_freq_khz = (end) * 1000, \ 349 - .freq_range.max_bandwidth_khz = (bw) * 1000, \ 350 - .power_rule.max_antenna_gain = (gain) * 100, \ 351 - .power_rule.max_eirp = (eirp) * 100, \ 347 + .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \ 348 + .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \ 349 + .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \ 350 + .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \ 351 + .power_rule.max_eirp = DBM_TO_MBM(eirp), \ 352 352 .flags = reg_flags, \ 353 353 } 354 354