Search Linux Wireless

[RFC v5 3/5] mac80211: generate hw flags from include file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Johannes Berg <johannes.berg@xxxxxxxxx>

Instead of having to list all the hw flags in many places, just
list the macro to generate everything in a new include file and
include it in the proper places.

Unfortunately this breaks docbook processing since that doesn't
pre-process the file. It also doesn't generate the necessary
Kconfig items.

Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
---
 include/net/mac80211-hwflags.h | 33 +++++++++++++++++++++++++++++
 include/net/mac80211.h         | 37 +++------------------------------
 net/mac80211/debugfs.c         | 47 ++++--------------------------------------
 3 files changed, 40 insertions(+), 77 deletions(-)
 create mode 100644 include/net/mac80211-hwflags.h

diff --git a/include/net/mac80211-hwflags.h b/include/net/mac80211-hwflags.h
new file mode 100644
index 000000000000..c0450391088c
--- /dev/null
+++ b/include/net/mac80211-hwflags.h
@@ -0,0 +1,33 @@
+/* this file intentionally has no include guard */
+DEFINE_HWFLAG(HAS_RATE_CONTROL)
+DEFINE_HWFLAG(RX_INCLUDES_FCS)
+DEFINE_HWFLAG(HOST_BROADCAST_PS_BUFFERING)
+DEFINE_HWFLAG(SIGNAL_UNSPEC)
+DEFINE_HWFLAG(SIGNAL_DBM)
+DEFINE_HWFLAG(NEED_DTIM_BEFORE_ASSOC)
+DEFINE_HWFLAG(SPECTRUM_MGMT)
+DEFINE_HWFLAG(AMPDU_AGGREGATION)
+DEFINE_HWFLAG(SUPPORTS_PS)
+DEFINE_HWFLAG(PS_NULLFUNC_STACK)
+DEFINE_HWFLAG(SUPPORTS_DYNAMIC_PS)
+DEFINE_HWFLAG(MFP_CAPABLE)
+DEFINE_HWFLAG(WANT_MONITOR_VIF)
+DEFINE_HWFLAG(NO_AUTO_VIF)
+DEFINE_HWFLAG(SW_CRYPTO_CONTROL)
+DEFINE_HWFLAG(SUPPORT_FAST_XMIT)
+DEFINE_HWFLAG(REPORTS_TX_ACK_STATUS)
+DEFINE_HWFLAG(CONNECTION_MONITOR)
+DEFINE_HWFLAG(QUEUE_CONTROL)
+DEFINE_HWFLAG(SUPPORTS_PER_STA_GTK)
+DEFINE_HWFLAG(AP_LINK_PS)
+DEFINE_HWFLAG(TX_AMPDU_SETUP_IN_HW)
+DEFINE_HWFLAG(SUPPORTS_RC_TABLE)
+DEFINE_HWFLAG(P2P_DEV_ADDR_FOR_INTF)
+DEFINE_HWFLAG(TIMING_BEACON_ONLY)
+DEFINE_HWFLAG(SUPPORTS_HT_CCK_RATES)
+DEFINE_HWFLAG(CHANCTX_STA_CSA)
+DEFINE_HWFLAG(SUPPORTS_CLONED_SKBS)
+DEFINE_HWFLAG(SINGLE_SCAN_ON_ALL_BANDS)
+DEFINE_HWFLAG(TDLS_WIDER_BW)
+DEFINE_HWFLAG(SUPPORTS_AMSDU_IN_AMPDU)
+DEFINE_HWFLAG(BEACON_TX_STATUS)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 82045fca388b..2345d3d43300 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1904,40 +1904,9 @@ struct ieee80211_txq {
  * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  */
 enum ieee80211_hw_flags {
-	IEEE80211_HW_HAS_RATE_CONTROL,
-	IEEE80211_HW_RX_INCLUDES_FCS,
-	IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING,
-	IEEE80211_HW_SIGNAL_UNSPEC,
-	IEEE80211_HW_SIGNAL_DBM,
-	IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC,
-	IEEE80211_HW_SPECTRUM_MGMT,
-	IEEE80211_HW_AMPDU_AGGREGATION,
-	IEEE80211_HW_SUPPORTS_PS,
-	IEEE80211_HW_PS_NULLFUNC_STACK,
-	IEEE80211_HW_SUPPORTS_DYNAMIC_PS,
-	IEEE80211_HW_MFP_CAPABLE,
-	IEEE80211_HW_WANT_MONITOR_VIF,
-	IEEE80211_HW_NO_AUTO_VIF,
-	IEEE80211_HW_SW_CRYPTO_CONTROL,
-	IEEE80211_HW_SUPPORT_FAST_XMIT,
-	IEEE80211_HW_REPORTS_TX_ACK_STATUS,
-	IEEE80211_HW_CONNECTION_MONITOR,
-	IEEE80211_HW_QUEUE_CONTROL,
-	IEEE80211_HW_SUPPORTS_PER_STA_GTK,
-	IEEE80211_HW_AP_LINK_PS,
-	IEEE80211_HW_TX_AMPDU_SETUP_IN_HW,
-	IEEE80211_HW_SUPPORTS_RC_TABLE,
-	IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF,
-	IEEE80211_HW_TIMING_BEACON_ONLY,
-	IEEE80211_HW_SUPPORTS_HT_CCK_RATES,
-	IEEE80211_HW_CHANCTX_STA_CSA,
-	IEEE80211_HW_SUPPORTS_CLONED_SKBS,
-	IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS,
-	IEEE80211_HW_TDLS_WIDER_BW,
-	IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU,
-	IEEE80211_HW_BEACON_TX_STATUS,
-
-	/* keep last, obviously */
+#define DEFINE_HWFLAG(_flg) IEEE80211_HW_##_flg,
+#include <net/mac80211-hwflags.h>
+#undef DEFINE_HWFLAG
 	NUM_IEEE80211_HW_FLAGS
 };
 
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 4d2aaebd4f97..dc0eca604be1 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -91,44 +91,10 @@ static const struct file_operations reset_ops = {
 };
 #endif
 
-static const char *hw_flag_names[NUM_IEEE80211_HW_FLAGS + 1] = {
-#define FLAG(F)	[IEEE80211_HW_##F] = #F
-	FLAG(HAS_RATE_CONTROL),
-	FLAG(RX_INCLUDES_FCS),
-	FLAG(HOST_BROADCAST_PS_BUFFERING),
-	FLAG(SIGNAL_UNSPEC),
-	FLAG(SIGNAL_DBM),
-	FLAG(NEED_DTIM_BEFORE_ASSOC),
-	FLAG(SPECTRUM_MGMT),
-	FLAG(AMPDU_AGGREGATION),
-	FLAG(SUPPORTS_PS),
-	FLAG(PS_NULLFUNC_STACK),
-	FLAG(SUPPORTS_DYNAMIC_PS),
-	FLAG(MFP_CAPABLE),
-	FLAG(WANT_MONITOR_VIF),
-	FLAG(NO_AUTO_VIF),
-	FLAG(SW_CRYPTO_CONTROL),
-	FLAG(SUPPORT_FAST_XMIT),
-	FLAG(REPORTS_TX_ACK_STATUS),
-	FLAG(CONNECTION_MONITOR),
-	FLAG(QUEUE_CONTROL),
-	FLAG(SUPPORTS_PER_STA_GTK),
-	FLAG(AP_LINK_PS),
-	FLAG(TX_AMPDU_SETUP_IN_HW),
-	FLAG(SUPPORTS_RC_TABLE),
-	FLAG(P2P_DEV_ADDR_FOR_INTF),
-	FLAG(TIMING_BEACON_ONLY),
-	FLAG(SUPPORTS_HT_CCK_RATES),
-	FLAG(CHANCTX_STA_CSA),
-	FLAG(SUPPORTS_CLONED_SKBS),
-	FLAG(SINGLE_SCAN_ON_ALL_BANDS),
-	FLAG(TDLS_WIDER_BW),
-	FLAG(SUPPORTS_AMSDU_IN_AMPDU),
-	FLAG(BEACON_TX_STATUS),
-
-	/* keep last for the build bug below */
-	(void *)0x1
-#undef FLAG
+static const char *hw_flag_names[NUM_IEEE80211_HW_FLAGS] = {
+#define DEFINE_HWFLAG(_flg)	[IEEE80211_HW_##_flg] = #_flg,
+#include <net/mac80211-hwflags.h>
+#undef DEFINE_HWFLAG
 };
 
 static ssize_t hwflags_read(struct file *file, char __user *user_buf,
@@ -144,11 +110,6 @@ static ssize_t hwflags_read(struct file *file, char __user *user_buf,
 	if (!buf)
 		return -ENOMEM;
 
-	/* fail compilation if somebody adds or removes
-	 * a flag without updating the name array above
-	 */
-	BUILD_BUG_ON(hw_flag_names[NUM_IEEE80211_HW_FLAGS] != (void *)0x1);
-
 	for (i = 0; i < NUM_IEEE80211_HW_FLAGS; i++) {
 		if (test_bit(i, local->hw.flags))
 			pos += scnprintf(pos, end - pos, "%s\n",
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux