Skip to content

Commit

Permalink
cfg80211: make use of reg macros on REG_RULE
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Luis R. Rodriguez authored and John W. Linville committed Nov 10, 2008
1 parent 9c96477 commit b219cee
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,19 +336,19 @@ struct ieee80211_regdomain {
struct ieee80211_reg_rule reg_rules[];
};

#define MHZ_TO_KHZ(freq) (freq * 1000)
#define KHZ_TO_MHZ(freq) (freq / 1000)
#define DBI_TO_MBI(gain) (gain * 100)
#define MBI_TO_DBI(gain) (gain / 100)
#define DBM_TO_MBM(gain) (gain * 100)
#define MBM_TO_DBM(gain) (gain / 100)
#define MHZ_TO_KHZ(freq) ((freq) * 1000)
#define KHZ_TO_MHZ(freq) ((freq) / 1000)
#define DBI_TO_MBI(gain) ((gain) * 100)
#define MBI_TO_DBI(gain) ((gain) / 100)
#define DBM_TO_MBM(gain) ((gain) * 100)
#define MBM_TO_DBM(gain) ((gain) / 100)

#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
.freq_range.start_freq_khz = (start) * 1000, \
.freq_range.end_freq_khz = (end) * 1000, \
.freq_range.max_bandwidth_khz = (bw) * 1000, \
.power_rule.max_antenna_gain = (gain) * 100, \
.power_rule.max_eirp = (eirp) * 100, \
.freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
.freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
.freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
.power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
.power_rule.max_eirp = DBM_TO_MBM(eirp), \
.flags = reg_flags, \
}

Expand Down

0 comments on commit b219cee

Please sign in to comment.