summaryrefslogtreecommitdiff
path: root/sound/soc/intel/avs/debugfs.c
diff options
context:
space:
mode:
authorCezary Rojewski <cezary.rojewski@intel.com>2022-12-02 16:28:33 +0100
committerMark Brown <broonie@kernel.org>2022-12-05 14:05:25 +0000
commitf7de161fc8d5e1ebac3c361a37b1d748e7086330 (patch)
treee5e70c42a5752ebcafe03fcfdb250311a7c10e87 /sound/soc/intel/avs/debugfs.c
parentb3eefa5d8dbfe5286c3308fa706fc9c45b38fe19 (diff)
ASoC: Intel: avs: Drop usage of debug members in non-debug code
Switch to debug-context aware wrappers instead of accessing debug members directly allowing for readable separation of debug and non-debug related code. Duplicates are removed along the way. Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20221202152841.672536-9-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/avs/debugfs.c')
-rw-r--r--sound/soc/intel/avs/debugfs.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sound/soc/intel/avs/debugfs.c b/sound/soc/intel/avs/debugfs.c
index ac3889e21542..78705bcb09fb 100644
--- a/sound/soc/intel/avs/debugfs.c
+++ b/sound/soc/intel/avs/debugfs.c
@@ -11,6 +11,24 @@
#include <linux/wait.h>
#include "avs.h"
+static unsigned int __kfifo_fromio(struct kfifo *fifo, const void __iomem *src, unsigned int len)
+{
+ struct __kfifo *__fifo = &fifo->kfifo;
+ unsigned int l, off;
+
+ len = min(len, kfifo_avail(fifo));
+ off = __fifo->in & __fifo->mask;
+ l = min(len, kfifo_size(fifo) - off);
+
+ memcpy_fromio(__fifo->data + off, src, l);
+ memcpy_fromio(__fifo->data, src + l, len - l);
+ /* Make sure data copied from SRAM is visible to all CPUs. */
+ smp_mb();
+ __fifo->in += len;
+
+ return len;
+}
+
bool avs_logging_fw(struct avs_dev *adev)
{
return kfifo_initialized(&adev->trace_fifo);