[PATCH 05/16] ASoC: Intel: avs: Drop fifo_lock

Cezary Rojewski cezary.rojewski at intel.com
Thu Dec 1 18:56:08 CET 2022


Log gathering is already locked, thanks to ->trace_lock.

Signed-off-by: Cezary Rojewski <cezary.rojewski at intel.com>
---
 sound/soc/intel/avs/apl.c   | 9 ++++-----
 sound/soc/intel/avs/avs.h   | 4 +---
 sound/soc/intel/avs/skl.c   | 2 +-
 sound/soc/intel/avs/utils.c | 6 +-----
 4 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/sound/soc/intel/avs/apl.c b/sound/soc/intel/avs/apl.c
index 821d5a9ad25f..66672ffd95df 100644
--- a/sound/soc/intel/avs/apl.c
+++ b/sound/soc/intel/avs/apl.c
@@ -65,13 +65,12 @@ static int apl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg
 	buf = apl_log_payload_addr(addr);
 
 	if (layout.read_ptr > layout.write_ptr) {
-		__kfifo_fromio_locked(&adev->dbg.trace_fifo, buf + layout.read_ptr,
-				      apl_log_payload_size(adev) - layout.read_ptr,
-				      &adev->dbg.fifo_lock);
+		__kfifo_fromio(&adev->dbg.trace_fifo, buf + layout.read_ptr,
+			       apl_log_payload_size(adev) - layout.read_ptr);
 		layout.read_ptr = 0;
 	}
-	__kfifo_fromio_locked(&adev->dbg.trace_fifo, buf + layout.read_ptr,
-			      layout.write_ptr - layout.read_ptr, &adev->dbg.fifo_lock);
+	__kfifo_fromio(&adev->dbg.trace_fifo, buf + layout.read_ptr,
+		       layout.write_ptr - layout.read_ptr);
 
 	wake_up(&adev->dbg.trace_waitq);
 
diff --git a/sound/soc/intel/avs/avs.h b/sound/soc/intel/avs/avs.h
index 1c89af6240d2..957151ecf39a 100644
--- a/sound/soc/intel/avs/avs.h
+++ b/sound/soc/intel/avs/avs.h
@@ -95,7 +95,6 @@ struct avs_fw_entry {
 
 struct avs_debug {
 	struct kfifo trace_fifo;
-	spinlock_t fifo_lock;	/* serialize I/O for trace_fifo */
 	spinlock_t trace_lock;	/* serialize debug window I/O between each LOG_BUFFER_STATUS */
 	wait_queue_head_t trace_waitq;
 	u32 aging_timer_period;
@@ -331,8 +330,7 @@ void avs_unregister_all_boards(struct avs_dev *adev);
 
 /* Firmware tracing helpers */
 
-unsigned int __kfifo_fromio_locked(struct kfifo *fifo, const void __iomem *src, unsigned int len,
-				   spinlock_t *lock);
+unsigned int __kfifo_fromio(struct kfifo *fifo, const void __iomem *src, unsigned int len);
 
 #define avs_log_buffer_size(adev) \
 	((adev)->fw_cfg.trace_log_bytes / (adev)->hw_cfg.dsp_cores)
diff --git a/sound/soc/intel/avs/skl.c b/sound/soc/intel/avs/skl.c
index ff690e99d960..936cd44eb73e 100644
--- a/sound/soc/intel/avs/skl.c
+++ b/sound/soc/intel/avs/skl.c
@@ -68,7 +68,7 @@ skl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg)
 
 	/* Address is guaranteed to exist in SRAM2. */
 	buf = avs_log_buffer_addr(adev, msg->log.core) + offset;
-	__kfifo_fromio_locked(&adev->dbg.trace_fifo, buf, size, &adev->dbg.fifo_lock);
+	__kfifo_fromio(&adev->dbg.trace_fifo, buf, size);
 	wake_up(&adev->dbg.trace_waitq);
 
 	return 0;
diff --git a/sound/soc/intel/avs/utils.c b/sound/soc/intel/avs/utils.c
index 13611dee9787..75ad434d7dfb 100644
--- a/sound/soc/intel/avs/utils.c
+++ b/sound/soc/intel/avs/utils.c
@@ -301,14 +301,11 @@ void avs_release_firmwares(struct avs_dev *adev)
 	}
 }
 
-unsigned int __kfifo_fromio_locked(struct kfifo *fifo, const void __iomem *src, unsigned int len,
-				   spinlock_t *lock)
+unsigned int __kfifo_fromio(struct kfifo *fifo, const void __iomem *src, unsigned int len)
 {
 	struct __kfifo *__fifo = &fifo->kfifo;
-	unsigned long flags;
 	unsigned int l, off;
 
-	spin_lock_irqsave(lock, flags);
 	len = min(len, kfifo_avail(fifo));
 	off = __fifo->in & __fifo->mask;
 	l = min(len, kfifo_size(fifo) - off);
@@ -318,7 +315,6 @@ unsigned int __kfifo_fromio_locked(struct kfifo *fifo, const void __iomem *src,
 	/* Make sure data copied from SRAM is visible to all CPUs. */
 	smp_mb();
 	__fifo->in += len;
-	spin_unlock_irqrestore(lock, flags);
 
 	return len;
 }
-- 
2.25.1



More information about the Alsa-devel mailing list