OSDN Git Service

ASoC: SOF: core: Add simple wrapper to check flags in sof_core_debug
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Thu, 23 Dec 2021 11:36:11 +0000 (13:36 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 23 Dec 2021 13:38:10 +0000 (13:38 +0000)
The sof_debug_check_flag() can be used to check a flag or a combination of
them in sof_core_debug.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/core.c
sound/soc/sof/sof-priv.h

index 40549cd..1224a7d 100644 (file)
@@ -27,6 +27,22 @@ MODULE_PARM_DESC(sof_debug, "SOF core debug options (0x0 all off)");
 #define TIMEOUT_DEFAULT_IPC_MS  500
 #define TIMEOUT_DEFAULT_BOOT_MS 2000
 
+/**
+ * sof_debug_check_flag - check if a given flag(s) is set in sof_core_debug
+ * @mask: Flag or combination of flags to check
+ *
+ * Returns true if all bits set in mask is also set in sof_core_debug, otherwise
+ * false
+ */
+bool sof_debug_check_flag(int mask)
+{
+       if ((sof_core_debug & mask) == mask)
+               return true;
+
+       return false;
+}
+EXPORT_SYMBOL(sof_debug_check_flag);
+
 /*
  * FW Panic/fault handling.
  */
index 114882e..35c5b2d 100644 (file)
@@ -43,6 +43,7 @@
 
 /* global debug state set by SOF_DBG_ flags */
 extern int sof_core_debug;
+bool sof_debug_check_flag(int mask);
 
 /* max BARs mmaped devices can use */
 #define SND_SOF_BARS   8