From a1ea528e187ee045aeff929ff0f4b2e53fdd970f Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Date: Wed, 4 Oct 2023 10:12:37 +0300
Subject: [PATCH] media: rp1: cfe: Rename xxx_dbg_irq() to xxx_dbg_verbose()

Rename the xxx_dbg_irq() macros to xxx_dbg_verbose(), as they can be
used to verbose debugs outside irq context too.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 .../media/platform/raspberrypi/rp1_cfe/cfe.c  | 40 +++++++++----------
 .../media/platform/raspberrypi/rp1_cfe/cfe.h  |  2 +-
 .../media/platform/raspberrypi/rp1_cfe/csi2.c | 26 ++++++------
 .../platform/raspberrypi/rp1_cfe/pisp_fe.c    | 12 +++---
 4 files changed, 40 insertions(+), 40 deletions(-)

--- a/drivers/media/platform/raspberrypi/rp1_cfe/cfe.c
+++ b/drivers/media/platform/raspberrypi/rp1_cfe/cfe.c
@@ -49,11 +49,11 @@
 #define CFE_MODULE_NAME	"rp1-cfe"
 #define CFE_VERSION	"1.0"
 
-bool cfe_debug_irq;
+bool cfe_debug_verbose;
 
-#define cfe_dbg_irq(fmt, arg...)                              \
+#define cfe_dbg_verbose(fmt, arg...)                          \
 	do {                                                  \
-		if (cfe_debug_irq)                            \
+		if (cfe_debug_verbose)                        \
 			dev_dbg(&cfe->pdev->dev, fmt, ##arg); \
 	} while (0)
 #define cfe_dbg(fmt, arg...) dev_dbg(&cfe->pdev->dev, fmt, ##arg)
@@ -518,8 +518,8 @@ static void cfe_schedule_next_csi2_job(s
 		node->next_frm = buf;
 		list_del(&buf->list);
 
-		cfe_dbg_irq("%s: [%s] buffer:%p\n", __func__,
-			    node_desc[node->id].name, &buf->vb.vb2_buf);
+		cfe_dbg_verbose("%s: [%s] buffer:%p\n", __func__,
+				node_desc[node->id].name, &buf->vb.vb2_buf);
 
 		if (is_meta_node(node)) {
 			size = node->fmt.fmt.meta.buffersize;
@@ -550,8 +550,8 @@ static void cfe_schedule_next_pisp_job(s
 		buf = list_first_entry(&node->dma_queue, struct cfe_buffer,
 				       list);
 
-		cfe_dbg_irq("%s: [%s] buffer:%p\n", __func__,
-			    node_desc[node->id].name, &buf->vb.vb2_buf);
+		cfe_dbg_verbose("%s: [%s] buffer:%p\n", __func__,
+				node_desc[node->id].name, &buf->vb.vb2_buf);
 
 		node->next_frm = buf;
 		vb2_bufs[node_desc[i].link_pad] = &buf->vb.vb2_buf;
@@ -573,8 +573,8 @@ static bool cfe_check_job_ready(struct c
 			continue;
 
 		if (list_empty(&node->dma_queue)) {
-			cfe_dbg_irq("%s: [%s] has no buffer, unable to schedule job\n",
-				    __func__, node_desc[i].name);
+			cfe_dbg_verbose("%s: [%s] has no buffer, unable to schedule job\n",
+				__func__, node_desc[i].name);
 			return false;
 		}
 	}
@@ -592,7 +592,7 @@ static void cfe_prepare_next_job(struct
 	/* Flag if another job is ready after this. */
 	cfe->job_ready = cfe_check_job_ready(cfe);
 
-	cfe_dbg_irq("%s: end with scheduled job\n", __func__);
+	cfe_dbg_verbose("%s: end with scheduled job\n", __func__);
 }
 
 static void cfe_process_buffer_complete(struct cfe_node *node,
@@ -600,8 +600,8 @@ static void cfe_process_buffer_complete(
 {
 	struct cfe_device *cfe = node->cfe;
 
-	cfe_dbg_irq("%s: [%s] buffer:%p\n", __func__, node_desc[node->id].name,
-		    &node->cur_frm->vb.vb2_buf);
+	cfe_dbg_verbose("%s: [%s] buffer:%p\n", __func__,
+			node_desc[node->id].name, &node->cur_frm->vb.vb2_buf);
 
 	node->cur_frm->vb.sequence = sequence;
 	vb2_buffer_done(&node->cur_frm->vb.vb2_buf, VB2_BUF_STATE_DONE);
@@ -621,8 +621,8 @@ static void cfe_sof_isr_handler(struct c
 {
 	struct cfe_device *cfe = node->cfe;
 
-	cfe_dbg_irq("%s: [%s] seq %u\n", __func__, node_desc[node->id].name,
-		    cfe->sequence);
+	cfe_dbg_verbose("%s: [%s] seq %u\n", __func__, node_desc[node->id].name,
+			cfe->sequence);
 
 	node->cur_frm = node->next_frm;
 	node->next_frm = NULL;
@@ -651,8 +651,8 @@ static void cfe_eof_isr_handler(struct c
 {
 	struct cfe_device *cfe = node->cfe;
 
-	cfe_dbg_irq("%s: [%s] seq %u\n", __func__, node_desc[node->id].name,
-		    cfe->sequence);
+	cfe_dbg_verbose("%s: [%s] seq %u\n", __func__, node_desc[node->id].name,
+			cfe->sequence);
 
 	if (node->cur_frm)
 		cfe_process_buffer_complete(node, cfe->sequence);
@@ -921,8 +921,8 @@ static int cfe_buffer_prepare(struct vb2
 	struct cfe_buffer *buf = to_cfe_buffer(vb);
 	unsigned long size;
 
-	cfe_dbg_irq("%s: [%s] buffer:%p\n", __func__, node_desc[node->id].name,
-		    vb);
+	cfe_dbg_verbose("%s: [%s] buffer:%p\n", __func__,
+			node_desc[node->id].name, vb);
 
 	size = is_image_output_node(node) ? node->fmt.fmt.pix.sizeimage :
 					    node->fmt.fmt.meta.buffersize;
@@ -954,8 +954,8 @@ static void cfe_buffer_queue(struct vb2_
 	struct cfe_buffer *buf = to_cfe_buffer(vb);
 	unsigned long flags;
 
-	cfe_dbg_irq("%s: [%s] buffer:%p\n", __func__, node_desc[node->id].name,
-		    vb);
+	cfe_dbg_verbose("%s: [%s] buffer:%p\n", __func__,
+			node_desc[node->id].name, vb);
 
 	spin_lock_irqsave(&cfe->state_lock, flags);
 
--- a/drivers/media/platform/raspberrypi/rp1_cfe/cfe.h
+++ b/drivers/media/platform/raspberrypi/rp1_cfe/cfe.h
@@ -11,7 +11,7 @@
 #include <linux/media-bus-format.h>
 #include <linux/videodev2.h>
 
-extern bool cfe_debug_irq;
+extern bool cfe_debug_verbose;
 
 enum cfe_remap_types {
 	CFE_REMAP_16BIT,
--- a/drivers/media/platform/raspberrypi/rp1_cfe/csi2.c
+++ b/drivers/media/platform/raspberrypi/rp1_cfe/csi2.c
@@ -16,9 +16,9 @@
 #include "csi2.h"
 #include "cfe.h"
 
-#define csi2_dbg_irq(fmt, arg...)                                 \
+#define csi2_dbg_verbose(fmt, arg...)                             \
 	do {                                                      \
-		if (cfe_debug_irq)                                \
+		if (cfe_debug_verbose)                            \
 			dev_dbg(csi2->v4l2_dev->dev, fmt, ##arg); \
 	} while (0)
 #define csi2_dbg(fmt, arg...) dev_dbg(csi2->v4l2_dev->dev, fmt, ##arg)
@@ -154,7 +154,7 @@ void csi2_isr(struct csi2_device *csi2,
 	u32 status;
 
 	status = csi2_reg_read(csi2, CSI2_STATUS);
-	csi2_dbg_irq("ISR: STA: 0x%x\n", status);
+	csi2_dbg_verbose("ISR: STA: 0x%x\n", status);
 
 	/* Write value back to clear the interrupts */
 	csi2_reg_write(csi2, CSI2_STATUS, status);
@@ -167,16 +167,16 @@ void csi2_isr(struct csi2_device *csi2,
 
 		dbg = csi2_reg_read(csi2, CSI2_CH_DEBUG(i));
 
-		csi2_dbg_irq("ISR: [%u], %s%s%s%s%s frame: %u line: %u\n", i,
-			     (status & IRQ_FS(i)) ? "FS " : "",
-			     (status & IRQ_FE(i)) ? "FE " : "",
-			     (status & IRQ_FE_ACK(i)) ? "FE_ACK " : "",
-			     (status & IRQ_LE(i)) ? "LE " : "",
-			     (status & IRQ_LE_ACK(i)) ? "LE_ACK " : "",
-			     dbg >> 16,
-			     csi2->num_lines[i] ?
-				     ((dbg & 0xffff) % csi2->num_lines[i]) :
-				     0);
+		csi2_dbg_verbose("ISR: [%u], %s%s%s%s%s frame: %u line: %u\n",
+				 i, (status & IRQ_FS(i)) ? "FS " : "",
+				 (status & IRQ_FE(i)) ? "FE " : "",
+				 (status & IRQ_FE_ACK(i)) ? "FE_ACK " : "",
+				 (status & IRQ_LE(i)) ? "LE " : "",
+				 (status & IRQ_LE_ACK(i)) ? "LE_ACK " : "",
+				 dbg >> 16,
+				 csi2->num_lines[i] ?
+					 ((dbg & 0xffff) % csi2->num_lines[i]) :
+					 0);
 
 		sof[i] = !!(status & IRQ_FS(i));
 		eof[i] = !!(status & IRQ_FE_ACK(i));
--- a/drivers/media/platform/raspberrypi/rp1_cfe/pisp_fe.c
+++ b/drivers/media/platform/raspberrypi/rp1_cfe/pisp_fe.c
@@ -114,9 +114,9 @@ static const struct pisp_fe_config_param
 					sizeof(struct pisp_fe_output_config)         },
 };
 
-#define pisp_fe_dbg_irq(fmt, arg...)                            \
+#define pisp_fe_dbg_verbose(fmt, arg...)                        \
 	do {                                                    \
-		if (cfe_debug_irq)                              \
+		if (cfe_debug_verbose)                          \
 			dev_dbg(fe->v4l2_dev->dev, fmt, ##arg); \
 	} while (0)
 #define pisp_fe_dbg(fmt, arg...) dev_dbg(fe->v4l2_dev->dev, fmt, ##arg)
@@ -202,9 +202,9 @@ void pisp_fe_isr(struct pisp_fe_device *
 	int_status = pisp_fe_reg_read(fe, FE_INT_STATUS);
 	pisp_fe_reg_write(fe, FE_INT_STATUS, int_status);
 
-	pisp_fe_dbg_irq("%s: status 0x%x out 0x%x frame 0x%x error 0x%x int 0x%x\n",
-			__func__, status, out_status, frame_status, error_status,
-			int_status);
+	pisp_fe_dbg_verbose("%s: status 0x%x out 0x%x frame 0x%x error 0x%x int 0x%x\n",
+		__func__, status, out_status, frame_status, error_status,
+		int_status);
 
 	/* We do not report interrupts for the input/stream pad. */
 	for (i = 0; i < FE_NUM_PADS - 1; i++) {
@@ -339,7 +339,7 @@ void pisp_fe_submit_job(struct pisp_fe_d
 	 * sequence of relaxed writes which follow.
 	 */
 	status = pisp_fe_reg_read(fe, FE_STATUS);
-	pisp_fe_dbg_irq("%s: status = 0x%x\n", __func__, status);
+	pisp_fe_dbg_verbose("%s: status = 0x%x\n", __func__, status);
 	if (WARN_ON(status & FE_STATUS_QUEUED))
 		return;
 
