aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/cfg80211.h
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2008-10-30 16:33:55 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-11-10 15:17:41 -0500
commitb219cee191e7cfe88a695a57249a295d0d5b22e9 (patch)
tree847fb7174520c9e6aa655ec7f563788336ced9aa /include/net/cfg80211.h
parent9c96477d10763d4314012425ecc8a3cff9e60ea9 (diff)
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>
Diffstat (limited to 'include/net/cfg80211.h')
-rw-r--r--include/net/cfg80211.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 448023193e55..1d57835d73f2 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -336,19 +336,19 @@ struct ieee80211_regdomain {
336 struct ieee80211_reg_rule reg_rules[]; 336 struct ieee80211_reg_rule reg_rules[];
337}; 337};
338 338
339#define MHZ_TO_KHZ(freq) (freq * 1000) 339#define MHZ_TO_KHZ(freq) ((freq) * 1000)
340#define KHZ_TO_MHZ(freq) (freq / 1000) 340#define KHZ_TO_MHZ(freq) ((freq) / 1000)
341#define DBI_TO_MBI(gain) (gain * 100) 341#define DBI_TO_MBI(gain) ((gain) * 100)
342#define MBI_TO_DBI(gain) (gain / 100) 342#define MBI_TO_DBI(gain) ((gain) / 100)
343#define DBM_TO_MBM(gain) (gain * 100) 343#define DBM_TO_MBM(gain) ((gain) * 100)
344#define MBM_TO_DBM(gain) (gain / 100) 344#define MBM_TO_DBM(gain) ((gain) / 100)
345 345
346#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \ 346#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
347 .freq_range.start_freq_khz = (start) * 1000, \ 347 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
348 .freq_range.end_freq_khz = (end) * 1000, \ 348 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
349 .freq_range.max_bandwidth_khz = (bw) * 1000, \ 349 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
350 .power_rule.max_antenna_gain = (gain) * 100, \ 350 .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
351 .power_rule.max_eirp = (eirp) * 100, \ 351 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
352 .flags = reg_flags, \ 352 .flags = reg_flags, \
353 } 353 }
354 354