linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Pedersen <thomas@adapt-ip.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
	Thomas Pedersen <thomas@adapt-ip.com>
Subject: [PATCH 1/9] ieee80211: share 802.11 unit conversion helpers
Date: Wed,  1 Apr 2020 18:18:02 -0700	[thread overview]
Message-ID: <20200402011810.22947-2-thomas@adapt-ip.com> (raw)
In-Reply-To: <20200402011810.22947-1-thomas@adapt-ip.com>

MHZ_TO_KHZ, and KHZ_TO_MHZ are useful to drivers and
elsewhere so export these in the common ieee80211 header.
Move the power helpers also because we might as well.

Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
---
 include/linux/ieee80211.h | 10 ++++++++++
 include/net/regulatory.h  |  7 -------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 16268ef1cbcc..8c4226b8a048 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -3323,6 +3323,16 @@ static inline int ieee80211_get_tdls_action(struct sk_buff *skb, u32 hdr_size)
 #define TU_TO_JIFFIES(x)	(usecs_to_jiffies((x) * 1024))
 #define TU_TO_EXP_TIME(x)	(jiffies + TU_TO_JIFFIES(x))
 
+/* convert frequencies */
+#define MHZ_TO_KHZ(freq) ((freq) * 1000)
+#define KHZ_TO_MHZ(freq) ((freq) / 1000)
+
+/* convert powers */
+#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)
+
 /**
  * ieee80211_action_contains_tpc - checks if the frame contains TPC element
  * @skb: the skb containing the frame, length will be checked
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index 3469750df0f4..09a3099886e5 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -231,13 +231,6 @@ 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 REG_RULE_EXT(start, end, bw, gain, eirp, dfs_cac, reg_flags)	\
 {									\
 	.freq_range.start_freq_khz = MHZ_TO_KHZ(start),			\
-- 
2.20.1


  reply	other threads:[~2020-04-02  1:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-02  1:18 [PATCH 0/9] initial support for S1G channels Thomas Pedersen
2020-04-02  1:18 ` Thomas Pedersen [this message]
2020-04-02  1:18 ` [PATCH 2/9] cfg80211: express channels with a KHz component Thomas Pedersen
2020-04-02  1:18 ` [PATCH 3/9] mac80211: handle channel frequency offset Thomas Pedersen
2020-04-02  1:18 ` [PATCH 4/9] mac80211: add freq_offset to RX status Thomas Pedersen
2020-04-02  1:18 ` [PATCH 5/9] cfg80211: report frequency in KHz for management RX Thomas Pedersen
2020-04-24 10:11   ` Johannes Berg
2020-04-02  1:18 ` [PATCH 6/9] nl80211: add KHz frequency offset for most wifi commands Thomas Pedersen
2020-04-02  1:18 ` [PATCH 7/9] nl80211: accept scan frequencies in KHz Thomas Pedersen
2020-04-02  1:18 ` [PATCH 8/9] ieee80211: S1G defines Thomas Pedersen
2020-04-02  1:18 ` [PATCH 9/9] nl80211: S1G band and channel definitions Thomas Pedersen

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=20200402011810.22947-2-thomas@adapt-ip.com \
    --to=thomas@adapt-ip.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).