summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/intel/iwlwifi/iwl-fw.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2015-09-22 12:24:31 +0200
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2015-11-26 16:38:50 +0200
commit4707fde5cdefc73c408915af2579c4acaf49ade4 (patch)
treea240ace8b7b9b0078a9d8fbefde87ff8d9c69e28 /drivers/net/wireless/intel/iwlwifi/iwl-fw.h
parent59fd4bf64591fbd02c6115d9282e2e7cffefa6e1 (diff)
iwlwifi: mvm: use build-time assertion for fw trigger ID
The firmware debug trigger ID is always a compile-time constant, so we can use a build-time assertion to validate that it is in fact a valid constant. To make that really guaranteed to work, convert this and the inline function iwl_fw_dbg_trigger_simple_stop() to macros. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/iwl-fw.h')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-fw.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw.h b/drivers/net/wireless/intel/iwlwifi/iwl-fw.h
index 84ec0cefb62a..c6946f1644fc 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-fw.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw.h
@@ -311,12 +311,15 @@ iwl_fw_dbg_conf_usniffer(const struct iwl_fw *fw, u8 id)
})
static inline struct iwl_fw_dbg_trigger_tlv*
-iwl_fw_dbg_get_trigger(const struct iwl_fw *fw, u8 id)
+_iwl_fw_dbg_get_trigger(const struct iwl_fw *fw, enum iwl_fw_dbg_trigger id)
{
- if (WARN_ON(id >= ARRAY_SIZE(fw->dbg_trigger_tlv)))
- return NULL;
-
return fw->dbg_trigger_tlv[id];
}
+#define iwl_fw_dbg_get_trigger(fw, id) ({ \
+ BUILD_BUG_ON(!__builtin_constant_p(id)); \
+ BUILD_BUG_ON((id) >= FW_DBG_TRIGGER_MAX); \
+ _iwl_fw_dbg_get_trigger((fw), (id)); \
+})
+
#endif /* __iwl_fw_h__ */