[PATCH 1/3] mialbox: move cmdq suspend, resume and remove after cmdq_mbox_flush

jason-jh.lin jason-jh.lin at mediatek.com
Wed Nov 17 06:41:56 UTC 2021


Move the function order to make sure cmdq_mbox_flush is declared
before cmdq_suspend calling it.

Signed-off-by: jason-jh.lin <jason-jh.lin at mediatek.com>
---
 drivers/mailbox/mtk-cmdq-mailbox.c | 84 +++++++++++++++---------------
 1 file changed, 42 insertions(+), 42 deletions(-)

diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
index c591dab9d5a4..03f9ed4c5131 100644
--- a/drivers/mailbox/mtk-cmdq-mailbox.c
+++ b/drivers/mailbox/mtk-cmdq-mailbox.c
@@ -296,48 +296,6 @@ static irqreturn_t cmdq_irq_handler(int irq, void *dev)
 	return IRQ_HANDLED;
 }
 
-static int cmdq_suspend(struct device *dev)
-{
-	struct cmdq *cmdq = dev_get_drvdata(dev);
-	struct cmdq_thread *thread;
-	int i;
-	bool task_running = false;
-
-	cmdq->suspended = true;
-
-	for (i = 0; i < cmdq->thread_nr; i++) {
-		thread = &cmdq->thread[i];
-		if (!list_empty(&thread->task_busy_list)) {
-			task_running = true;
-			break;
-		}
-	}
-
-	if (task_running)
-		dev_warn(dev, "exist running task(s) in suspend\n");
-
-	clk_bulk_unprepare(cmdq->gce_num, cmdq->clocks);
-
-	return 0;
-}
-
-static int cmdq_resume(struct device *dev)
-{
-	struct cmdq *cmdq = dev_get_drvdata(dev);
-
-	WARN_ON(clk_bulk_prepare(cmdq->gce_num, cmdq->clocks));
-	cmdq->suspended = false;
-	return 0;
-}
-
-static int cmdq_remove(struct platform_device *pdev)
-{
-	struct cmdq *cmdq = platform_get_drvdata(pdev);
-
-	clk_bulk_unprepare(cmdq->gce_num, cmdq->clocks);
-	return 0;
-}
-
 static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data)
 {
 	struct cmdq_pkt *pkt = (struct cmdq_pkt *)data;
@@ -521,6 +479,48 @@ static struct mbox_chan *cmdq_xlate(struct mbox_controller *mbox,
 	return &mbox->chans[ind];
 }
 
+static int cmdq_suspend(struct device *dev)
+{
+	struct cmdq *cmdq = dev_get_drvdata(dev);
+	struct cmdq_thread *thread;
+	int i;
+	bool task_running = false;
+
+	cmdq->suspended = true;
+
+	for (i = 0; i < cmdq->thread_nr; i++) {
+		thread = &cmdq->thread[i];
+		if (!list_empty(&thread->task_busy_list)) {
+			task_running = true;
+			break;
+		}
+	}
+
+	if (task_running)
+		dev_warn(dev, "exist running task(s) in suspend\n");
+
+	clk_bulk_unprepare(cmdq->gce_num, cmdq->clocks);
+
+	return 0;
+}
+
+static int cmdq_resume(struct device *dev)
+{
+	struct cmdq *cmdq = dev_get_drvdata(dev);
+
+	WARN_ON(clk_bulk_prepare(cmdq->gce_num, cmdq->clocks));
+	cmdq->suspended = false;
+	return 0;
+}
+
+static int cmdq_remove(struct platform_device *pdev)
+{
+	struct cmdq *cmdq = platform_get_drvdata(pdev);
+
+	clk_bulk_unprepare(cmdq->gce_num, cmdq->clocks);
+	return 0;
+}
+
 static int cmdq_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-- 
2.18.0



More information about the dri-devel mailing list