Linux wireless drivers development
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: <linville@tuxdriver.com>, <johannes@sipsolutions.net>,
	<linville@tuxdriver.com>
Cc: "Luis R. Rodriguez" <lrodriguez@atheros.com>,
	<linux-wireless@vger.kernel.org>
Subject: [PATCH 4/6] cfg80211: make use of reg macros on REG_RULE
Date: Wed, 29 Oct 2008 18:19:52 -0700	[thread overview]
Message-ID: <1225329594-21704-5-git-send-email-lrodriguez@atheros.com> (raw)
In-Reply-To: <1225329594-21704-4-git-send-email-lrodriguez@atheros.com>

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

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 include/net/cfg80211.h |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 03e1e88..81c97a7 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -331,19 +331,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, \
 	}
 
-- 
1.5.6.3


  reply	other threads:[~2008-10-30  1:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-30  1:19 [PATCH 0/6] cfg80211: few regulatory updates Luis R. Rodriguez
2008-10-30  1:19 ` [PATCH 1/6] cfg80211: a reg rule is invalid if freq diff is 0 Luis R. Rodriguez
2008-10-30  1:19   ` [PATCH 2/6] cfg80211: Add regulatory domain intersection capability Luis R. Rodriguez
2008-10-30  1:19     ` [PATCH 3/6] cfg80211: make print_regdomain_info() static Luis R. Rodriguez
2008-10-30  1:19       ` Luis R. Rodriguez [this message]
2008-10-30  1:19         ` [PATCH 5/6] cfg80211: Add kdoc for struct regulatory_request Luis R. Rodriguez
2008-10-30  1:19           ` [PATCH 6/6] cfg80211: enable 5 GHz band for world regulatory domain Luis R. Rodriguez
2008-10-30  9:24             ` Johannes Berg
2008-10-30 16:09               ` Luis R. Rodriguez
2008-10-30 17:18                 ` Johannes Berg
2008-10-30 17:43                   ` Luis R. Rodriguez
2008-10-30 18:12                   ` Jouni Malinen
2008-10-30  9:22   ` [PATCH 1/6] cfg80211: a reg rule is invalid if freq diff is 0 Johannes Berg
2008-10-30 19:40     ` Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1225329594-21704-5-git-send-email-lrodriguez@atheros.com \
    --to=lrodriguez@atheros.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox