[PATCH v2 6/6] media: mtk-vpu: rename IPI_MAX to IPI_VPU_MAX

GUO Ren (XuanTie) guoren at kernel.org
Thu Sep 10 20:27:14 PDT 2026


The last enumerator of this driver's firmware IPI id list is a bound
for the VPU mailbox protocol, not a generic host IPI limit. Follow the
existing naming in this header: IPI_VPU_INIT already carries a VPU
prefix, so the terminator should match.

The same convention is used by the SCP IPI enum, which ends with a
prefixed SCP_IPI_MAX rather than a bare IPI_MAX.

Rename IPI_MAX to IPI_VPU_MAX and update the descriptor table bounds
and range checks. No functional change.

Link: https://lore.kernel.org/linux-riscv/20260908222349.GA2324870@ax162
Cc: Nathan Chancellor <nathan at kernel.org>
Signed-off-by: GUO Ren (XuanTie) <guoren at kernel.org>
---
 drivers/media/platform/mediatek/vpu/mtk_vpu.c | 12 ++++++------
 drivers/media/platform/mediatek/vpu/mtk_vpu.h |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.c b/drivers/media/platform/mediatek/vpu/mtk_vpu.c
index 8d8319f0cd22..b3e9f8c4ab7a 100644
--- a/drivers/media/platform/mediatek/vpu/mtk_vpu.c
+++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.c
@@ -211,7 +211,7 @@ struct mtk_vpu {
 	struct vpu_regs reg;
 	struct vpu_run run;
 	struct vpu_wdt wdt;
-	struct vpu_ipi_desc ipi_desc[IPI_MAX];
+	struct vpu_ipi_desc ipi_desc[IPI_VPU_MAX];
 	struct share_obj __iomem *recv_buf;
 	struct share_obj __iomem *send_buf;
 	struct device *dev;
@@ -221,7 +221,7 @@ struct mtk_vpu {
 	struct mutex vpu_mutex; /* for protecting vpu data data structure */
 	u32 wdt_refcnt;
 	wait_queue_head_t ack_wq;
-	bool ipi_id_ack[IPI_MAX];
+	bool ipi_id_ack[IPI_VPU_MAX];
 };
 
 static inline void vpu_cfg_writel(struct mtk_vpu *vpu, u32 val, u32 offset)
@@ -296,7 +296,7 @@ int vpu_ipi_register(struct platform_device *pdev,
 		return -EPROBE_DEFER;
 	}
 
-	if (id < IPI_MAX && handler) {
+	if (id < IPI_VPU_MAX && handler) {
 		ipi_desc = vpu->ipi_desc;
 		ipi_desc[id].name = name;
 		ipi_desc[id].handler = handler;
@@ -319,7 +319,7 @@ int vpu_ipi_send(struct platform_device *pdev,
 	unsigned long timeout;
 	int ret = 0;
 
-	if (id <= IPI_VPU_INIT || id >= IPI_MAX ||
+	if (id <= IPI_VPU_INIT || id >= IPI_VPU_MAX ||
 	    len > sizeof(send_obj->share_buf) || !buf) {
 		dev_err(vpu->dev, "failed to send ipi message\n");
 		return -EINVAL;
@@ -748,7 +748,7 @@ static void vpu_ipi_handler(struct mtk_vpu *vpu)
 	s32 id = readl(&rcv_obj->id);
 
 	memcpy_fromio(data, rcv_obj->share_buf, sizeof(data));
-	if (id < IPI_MAX && ipi_desc[id].handler) {
+	if (id < IPI_VPU_MAX && ipi_desc[id].handler) {
 		ipi_desc[id].handler(data, readl(&rcv_obj->len),
 				     ipi_desc[id].priv);
 		if (id > IPI_VPU_INIT) {
@@ -934,7 +934,7 @@ static int mtk_vpu_probe(struct platform_device *pdev)
 #ifdef CONFIG_DEBUG_FS
 	debugfs_remove(vpu_debugfs);
 #endif
-	memset(vpu->ipi_desc, 0, sizeof(struct vpu_ipi_desc) * IPI_MAX);
+	memset(vpu->ipi_desc, 0, sizeof(struct vpu_ipi_desc) * IPI_VPU_MAX);
 vpu_mutex_destroy:
 	mutex_destroy(&vpu->vpu_mutex);
 disable_vpu_clk:
diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.h b/drivers/media/platform/mediatek/vpu/mtk_vpu.h
index 3951547e9ec5..44ab631ec904 100644
--- a/drivers/media/platform/mediatek/vpu/mtk_vpu.h
+++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.h
@@ -49,7 +49,7 @@ typedef void (*ipi_handler_t) (void *data,
  *			 handle VP8 video encoder job,, and vice versa.
  * @IPI_MDP:		 The interrupt from vpu is to notify kernel to
  *			 handle MDP (Media Data Path) job, and vice versa.
- * @IPI_MAX:		 The maximum IPI number
+ * @IPI_VPU_MAX:	 The maximum VPU IPI number
  */
 
 enum ipi_id {
@@ -60,7 +60,7 @@ enum ipi_id {
 	IPI_VENC_H264,
 	IPI_VENC_VP8,
 	IPI_MDP,
-	IPI_MAX,
+	IPI_VPU_MAX,
 };
 
 /**

-- 
2.43.0




More information about the Linux-mediatek mailing list