Skip to contentSkip to conversation

Fix drm suspend and resume issue

PATCH In review jason-jh.lin 3 participants 13 messages Nov 17, 2021 – Nov 28, 2021 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Subject: [PATCH 0/3] Fix drm suspend and resume issue

1. When the hardwire components on crtc is using GCE to configure their register, cmdq_suspend may be called.
So add cmdq_mbox_flush to clear all tasks and release GCE clocks before cmdq_suspend.

2. The suspend and resume order of components on crtc can be guaranteed by the same power-domain, but cmdq can not.
So add devlink to cmdq dev make sure the order of suspend and resume:
cmdq_suspend is latter than drm_suspend and
cmdq_resume is earlier than drm_resume.

jason-jh.lin (3):
mialbox: move cmdq suspend,resume and remove after cmdq_mbox_flush
mailbox: add cmdq_mbox_flush to clear all task before suspend drm/mediatek: add devlink to cmdq dev

 drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 13 ++++
 drivers/mailbox/mtk-cmdq-mailbox.c      | 81 ++++++++++++-------------
 2 files changed, 52 insertions(+), 42 deletions(-)
Signature · 1 line
2.18.0
#1 lore raw

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

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

---
 drivers/mailbox/mtk-cmdq-mailbox.c | 84 +++++++++++++++---------------
 1 file changed, 42 insertions(+), 42 deletions(-)
drivers/mailbox/mtk-cmdq-mailbox.c +42 -42
index c591dab9d5a4..03f9ed4c5131 100644
@@ -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;
Signature · 1 line
2.18.0
#2 lore raw

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

On Wed, Nov 17, 2021 at 02:41:56PM +0800, jason-jh.lin wrote:

Typo in the commit title "mialbox: move cmdq suspend,resume and remove after cmdq_mbox_flush".

s/mialbox/mailbox/

#3 lore raw

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

Hi Tzung-Bi,

Thanks for the reviews.

Quoted 6 lines · Tzung-Bi Shih

On Wed, Nov 17, 2021 at 02:41:56PM +0800, jason-jh.lin wrote:

Typo in the commit title "mialbox: move cmdq suspend,resume and remove after cmdq_mbox_flush".

s/mialbox/mailbox/

Signature · 4 lines
I'll fix this typo at the next version.

Regards,
Jason-JH Lin <[email protected]>
#4 lore raw

PATCH 2/3 mailbox: add cmdq_mbox_flush to clear all task before suspend

In reply to jason-jh.lin

CMDQ driver will occupy GCE clock to execute the task in GCE thread.

So call cmdq_mbox_flush to clear all task in GCE thread before CMDQ suspend.

---
 drivers/mailbox/mtk-cmdq-mailbox.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/mailbox/mtk-cmdq-mailbox.c +3 -6
index 03f9ed4c5131..28cadfc0091b 100644
@@ -484,21 +484,18 @@ 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;
+			/* try to clear all task in this thread */
+			cmdq_mbox_flush(thread->chan, 2000);
+			dev_warn(dev, "thread[%d] exist running task(s) in suspend\n", i);
 		}
 	}
 
-	if (task_running)
-		dev_warn(dev, "exist running task(s) in suspend\n");
-
 	clk_bulk_unprepare(cmdq->gce_num, cmdq->clocks);
 
 	return 0;
Signature · 1 line
2.18.0
maintainer
#5 lore raw

Re: [PATCH 2/3] mailbox: add cmdq_mbox_flush to clear all task before suspend

Hi, Jason:

jason-jh.lin <[email protected]> 於 2021年11月17日 週三 下午2:42寫道:

Quoted 20 lines

CMDQ driver will occupy GCE clock to execute the task in GCE thread.

So call cmdq_mbox_flush to clear all task in GCE thread before CMDQ suspend.

---
 drivers/mailbox/mtk-cmdq-mailbox.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/mailbox/mtk-cmdq-mailbox.c +0 -1
index 03f9ed4c5131..28cadfc0091b 100644
@@ -484,21 +484,18 @@ static int cmdq_suspend(struct device *dev)
        struct cmdq *cmdq = dev_get_drvdata(dev);
        struct cmdq_thread *thread;
        int i;
-       bool task_running = false;

drivers/mailbox/mtk-cmdq-mailbox.c static int cmdq_suspend(struct device *dev) · line 494

Quoted 10 lines
drivers/mailbox/mtk-cmdq-mailbox.c +2 -2
 
        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;
+                       /* try to clear all task in this thread */
+                       cmdq_mbox_flush(thread->chan, 2000);

I would like the normal control flow rather than error handling. So the normal control flow is:

1. Client driver suspend: Flush command.
2. CMDQ driver suspend: There is no command to flush. If there are command, show error message and debug the client driver.

The error handling flow:

1. Client driver suspend: Does not flush command.
2. CMDQ driver suspend: Flush command and callback to client driver. Client driver process these callback as error handling.

The client driver may integrate multiple driver. In the suspend flow, it may need to stop these driver in a sequence such as.

1. Stop driver 1
2. Stop driver 2
3. Stop driver 3 (cmdq)
4. Stop driver 4
5. Stop driver 5.

In the normal flow, client driver could control the stop flow. In the error handling flow, it does not match the stop flow.

Regards,
Chun-Kuang.

Quoted 13 lines
drivers/mailbox/mtk-cmdq-mailbox.c +1 -4
+                       dev_warn(dev, "thread[%d] exist running task(s) in suspend\n", i);
                }
        }
 
-       if (task_running)
-               dev_warn(dev, "exist running task(s) in suspend\n");
-
        clk_bulk_unprepare(cmdq->gce_num, cmdq->clocks);
 
        return 0;
--

2.18.0

#6 lore raw

Re: [PATCH 2/3] mailbox: add cmdq_mbox_flush to clear all task before suspend

Hi Chun-Kuang,

Thanks for the reviews.

Quoted 58 lines · Chun-Kuang Hu

Hi, Jason:

jason-jh.lin <[email protected]> 於 2021年11月17日 週三 下午2:42寫道:

Quoted 22 lines

CMDQ driver will occupy GCE clock to execute the task in GCE thread.

So call cmdq_mbox_flush to clear all task in GCE thread before CMDQ suspend.

---
 drivers/mailbox/mtk-cmdq-mailbox.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/mailbox/mtk-cmdq-mailbox.c +0 -1
index 03f9ed4c5131..28cadfc0091b 100644
@@ -484,21 +484,18 @@ static int cmdq_suspend(struct device *dev)
        struct cmdq *cmdq = dev_get_drvdata(dev);
        struct cmdq_thread *thread;
        int i;
-       bool task_running = false;

drivers/mailbox/mtk-cmdq-mailbox.c static int cmdq_suspend(struct device *dev) · line 494

Quoted 10 lines
drivers/mailbox/mtk-cmdq-mailbox.c +2 -2
 
        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;
+                       /* try to clear all task in this thread */
+                       cmdq_mbox_flush(thread->chan, 2000);

I would like the normal control flow rather than error handling. So the normal control flow is:

1. Client driver suspend: Flush command.
2. CMDQ driver suspend: There is no command to flush. If there are command, show error message and debug the client driver.

The error handling flow:

1. Client driver suspend: Does not flush command.
2. CMDQ driver suspend: Flush command and callback to client driver. Client driver process these callback as error handling.

The client driver may integrate multiple driver. In the suspend flow, it may need to stop these driver in a sequence such as.

1. Stop driver 1
2. Stop driver 2
3. Stop driver 3 (cmdq)
4. Stop driver 4
5. Stop driver 5.

Quoted 6 lines

In the normal flow, client driver could control the stop flow. In the error handling flow, it does not match the stop flow.

Regards,
Chun-Kuang.

I have tried the normal flow:
1. Client driver suspend: Flush command.
2. CMDQ driver suspend: There is no command to flush. If there are command, show error message and debug the client driver.

Then I found the cmdq task of crtc_1 is still executing when cmdq_suspend sometimes. I think it is the latest async cmd sent in mtk_drm_crtc_disable.
So I'll try to change it to blocking cmd and see the issue is still happened or not.

If it works, then I'll revert this patch and send add blocking cmd in mtk_drm_crtc_disable at the next version.

Regards,
Jason-JH.Lin

Quoted 15 lines
Quoted 15 lines
drivers/mailbox/mtk-cmdq-mailbox.c +1 -3
+                       dev_warn(dev, "thread[%d] exist running
 task(s) in suspend\n", i);
                }
        }
 
-       if (task_running)
-               dev_warn(dev, "exist running task(s) in
 suspend\n");
-
        clk_bulk_unprepare(cmdq->gce_num, cmdq->clocks);
        return 0;

--
2.18.0

Signature · 1 line
Jason-JH Lin <[email protected]>
#7 lore raw

PATCH 3/3 drm/mediatek: add devlink to cmdq dev

In reply to jason-jh.lin

Add devlink to cmdq to make sure the order of suspend and resume is correct.

---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +13 -0
index 24d9bde4d6e2..0a472719709d 100644
@@ -59,6 +59,7 @@ struct mtk_drm_crtc {
 #endif
 
 	struct device			*mmsys_dev;
+	struct device			*drm_dev;
 	struct mtk_mutex		*mutex;
 	unsigned int			ddp_comp_nr;
 	struct mtk_ddp_comp		**ddp_comp;
@@ -158,6 +159,7 @@ static void mtk_drm_crtc_destroy(struct drm_crtc *crtc)
 	mtk_drm_cmdq_pkt_destroy(&mtk_crtc->cmdq_handle);
 
 	if (mtk_crtc->cmdq_client.chan) {
+		device_link_remove(mtk_crtc->drm_dev, mtk_crtc->cmdq_client.chan->mbox->dev);
 		mbox_free_channel(mtk_crtc->cmdq_client.chan);
 		mtk_crtc->cmdq_client.chan = NULL;
 	}
@@ -888,6 +890,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
 		return -ENOMEM;
 
 	mtk_crtc->mmsys_dev = priv->mmsys_dev;
+	mtk_crtc->drm_dev = dev;
 	mtk_crtc->ddp_comp_nr = path_len;
 	mtk_crtc->ddp_comp = devm_kmalloc_array(dev, mtk_crtc->ddp_comp_nr,
 						sizeof(*mtk_crtc->ddp_comp),
@@ -956,6 +959,16 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
 	}
 
 	if (mtk_crtc->cmdq_client.chan) {
+		struct device_link *link;
+
+		/* add devlink to cmdq dev to make sure suspend/resume order is correct */
+		link = device_link_add(dev, mtk_crtc->cmdq_client.chan->mbox->dev,
+				       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
+		if (!link) {
+			dev_err(dev, "Unable to link dev=%s\n",
+				dev_name(mtk_crtc->cmdq_client.chan->mbox->dev));
+		}
+
 		ret = of_property_read_u32_index(priv->mutex_node,
 						 "mediatek,gce-events",
 						 drm_crtc_index(&mtk_crtc->base),
Signature · 1 line
2.18.0
#8 lore raw

Re: [PATCH 3/3] drm/mediatek: add devlink to cmdq dev

Quoted 8 lines · jason-jh.lin
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1 -0
@@ -158,6 +159,7 @@ static void mtk_drm_crtc_destroy(struct drm_crtc *crtc)
 	mtk_drm_cmdq_pkt_destroy(&mtk_crtc->cmdq_handle);
 
 	if (mtk_crtc->cmdq_client.chan) {
+		device_link_remove(mtk_crtc->drm_dev, mtk_crtc->cmdq_client.chan->mbox->dev);
 		mbox_free_channel(mtk_crtc->cmdq_client.chan);
 		mtk_crtc->cmdq_client.chan = NULL;
 	}

[...]

Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +0 -0
@@ -956,6 +959,16 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
 	}
 
 	if (mtk_crtc->cmdq_client.chan) {

drivers/gpu/drm/mediatek/mtk_drm_crtc.c int mtk_drm_crtc_create(struct drm_device *drm_dev, · line 971

Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +10 -0
+		struct device_link *link;
+
+		/* add devlink to cmdq dev to make sure suspend/resume order is correct */
+		link = device_link_add(dev, mtk_crtc->cmdq_client.chan->mbox->dev,
+				       DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
+		if (!link) {
+			dev_err(dev, "Unable to link dev=%s\n",
+				dev_name(mtk_crtc->cmdq_client.chan->mbox->dev));
+		}
+

If device_link_add() failed, doesn't mtk_drm_crtc_create() need to return an error and exit?

OTOH, if device_link_add() failed, won't it bring any side effects to call device_link_remove()?

A message that is not in the archive (sent off-list or not yet received): PU1PR03MB306252A252139515F7EA9ABCB8659@PU1PR03MB3062.apcprd03.prod.outlook.com

#10 lore raw

Re: FW: [PATCH 3/3] drm/mediatek: add devlink to cmdq dev

Hi Tzung-Bi,

Thanks for the reviews.

Quoted 43 lines

From: Linux-mediatek <[email protected]> On Behalf Of Tzung-Bi Shih
Sent: Thursday, November 18, 2021 1:55 PM
To: Jason-JH Lin (林睿祥) <[email protected]>
Cc: Chun-Kuang Hu <[email protected]>; Philipp Zabel < [email protected]>; Matthias Brugger <[email protected]>; Jassi Brar <[email protected]>; David Airlie <[email protected]

Quoted 1 line

; Daniel Vetter <[email protected]>; [email protected];

[email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nancy Lin (林欣螢) < [email protected]>; Singo Chang (張興國) <[email protected]>
Subject: Re: [PATCH 3/3] drm/mediatek: add devlink to cmdq dev

Quoted 10 lines · jason-jh.lin
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1 -0
@@ -158,6 +159,7 @@ static void mtk_drm_crtc_destroy(struct
 drm_crtc *crtc)
 	mtk_drm_cmdq_pkt_destroy(&mtk_crtc->cmdq_handle);
 
 	if (mtk_crtc->cmdq_client.chan) {
+		device_link_remove(mtk_crtc->drm_dev, mtk_crtc-
 >cmdq_client.chan->mbox->dev);
 		mbox_free_channel(mtk_crtc->cmdq_client.chan);
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +0 -0
 		mtk_crtc->cmdq_client.chan = NULL;
 	}

[...]

Quoted 16 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +3 -0
@@ -956,6 +959,16 @@ int mtk_drm_crtc_create(struct drm_device
 *drm_dev,
 	}
 
 	if (mtk_crtc->cmdq_client.chan) {
+		struct device_link *link;
+
+		/* add devlink to cmdq dev to make sure suspend/resume

order is correct */

(quoted diff) +1 -0
+		link = device_link_add(dev, mtk_crtc->cmdq_client.chan-
Quoted 1 line

mbox->dev,

(quoted diff) +1 -0
+				       DL_FLAG_PM_RUNTIME |

DL_FLAG_STATELESS);

drivers/gpu/drm/mediatek/mtk_drm_crtc.c +3 -0
+		if (!link) {
+			dev_err(dev, "Unable to link dev=%s\n",
+				dev_name(mtk_crtc->cmdq_client.chan-
Quoted 6 lines

drivers/gpu/drm/mediatek/mtk_drm_crtc.c int mtk_drm_crtc_create(struct drm_device *drm_dev, · line 971

Quoted 3 lines
Quoted 1 line

mbox->dev));

drivers/gpu/drm/mediatek/mtk_drm_crtc.c +2 -0
+		}
+

If device_link_add() failed, doesn't mtk_drm_crtc_create() need to return an error and exit?

OK, I'll add the return error at the next verion.

Quoted 4 lines

OTOH, if device_link_add() failed, won't it bring any side effects to call device_link_remove()?

Because device_link_remove() will find the device_link of supplier and consumer, then delete the device_link between them.
If device_link_add() failed, supplier and consumer won't create the device_link.
So calling device_link_remove() won't do anything without deive_link and won't bring any side effects.

Regards,
Jason-JH.Lin

Quoted 4 lines

_______________________________________________
Linux-mediatek mailing list
[email protected]

https://urldefense.com/v3/__http://lists.infradead.org/mailman/listinfo/linux-mediatek__;!!CTRNKA9wMg0ARbw!125dmOZ7xCLkwbIrzZf1VqVLQBbdT4RFHoMjR38U1GeCxaTM6xvvB-mSr7sTc6BuY5IH$

Quoted 1 line
Signature · 1 line
Jason-JH Lin <[email protected]>
#11 lore raw

Re: FW: [PATCH 3/3] drm/mediatek: add devlink to cmdq dev

Hi Tzung-Bi,

Thanks for the reviews.

Quoted 44 lines

From: Linux-mediatek <[email protected]> On Behalf Of Tzung-Bi Shih
Sent: Thursday, November 18, 2021 1:55 PM
To: Jason-JH Lin (林睿祥) <[email protected]>
Cc: Chun-Kuang Hu <[email protected]>; Philipp Zabel < [email protected]>; Matthias Brugger <[email protected]>; Jassi Brar <[email protected]>; David Airlie <[email protected] [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nancy Lin (林欣螢) < [email protected]>; Singo Chang (張興國)[email protected]>
Subject: Re: [PATCH 3/3] drm/mediatek: add devlink to cmdq dev

Quoted 11 lines · jason-jh.lin
(quoted diff) +1 -0
@@ -158,6 +159,7 @@ static void mtk_drm_crtc_destroy(struct
 drm_crtc *crtc)
 	mtk_drm_cmdq_pkt_destroy(&mtk_crtc->cmdq_handle);
 
 	if (mtk_crtc->cmdq_client.chan) {
+		device_link_remove(mtk_crtc->drm_dev, mtk_crtc->
 cmdq_client.chan->mbox->dev);
 
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +0 -0
 		mbox_free_channel(mtk_crtc->cmdq_client.chan);
 		mtk_crtc->cmdq_client.chan = NULL;
 	}

[...]

Quoted 17 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +3 -0
@@ -956,6 +959,16 @@ int mtk_drm_crtc_create(struct drm_device
 *drm_dev,
 	}
 
 	if (mtk_crtc->cmdq_client.chan) {
+		struct device_link *link;
+
+		/* add devlink to cmdq dev to make sure suspend/resume

order is correct */

(quoted diff) +1 -0
+		link = device_link_add(dev, mtk_crtc->cmdq_client.chan-
Quoted 1 line

mbox->dev,

(quoted diff) +1 -0
+				       DL_FLAG_PM_RUNTIME |

DL_FLAG_STATELESS);

drivers/gpu/drm/mediatek/mtk_drm_crtc.c +3 -0
+		if (!link) {
+			dev_err(dev, "Unable to link dev=%s\n",
+				dev_name(mtk_crtc->cmdq_client.chan-
Quoted 7 lines

drivers/gpu/drm/mediatek/mtk_drm_crtc.c int mtk_drm_crtc_create(struct drm_device *drm_dev, · line 971

Quoted 4 lines
Quoted 1 line

mbox->dev));

drivers/gpu/drm/mediatek/mtk_drm_crtc.c +2 -0
+		}
+

If device_link_add() failed, doesn't mtk_drm_crtc_create() need to return an error and exit?

OK, I'll add the return error at the next verion.

Quoted 4 lines

OTOH, if device_link_add() failed, won't it bring any side effects to call device_link_remove()?

Because device_link_remove() will find the device_link of supplier and consumer, then delete the device_link between them.
If device_link_add() failed, supplier and consumer won't create the device_link.
So calling device_link_remove() won't do anything without deive_link and won't bring any side effects.

Regards,
Jason-JH.Lin

Quoted 7 lines

_______________________________________________
Linux-mediatek mailing list
[email protected]

https://urldefense.com/v3/__http://lists.infradead.org/mailman/listinfo/linux-mediatek__;!!CTRNKA9wMg0ARbw!125dmOZ7xCLkwbIrzZf1VqVLQBbdT4RFHoMjR38U1GeCxaTM6xvvB-mSr7sTc6BuY5IH$

Quoted 1 line

https://urldefense.com/v3/__http://lists.infradead.org/mailman/listinfo/linux-mediatek__;!!CTRNKA9wMg0ARbw!125dmOZ7xCLkwbIrzZf1VqVLQBbdT4RFHoMjR38U1GeCxaTM6xvvB-mSr7sTc6BuY5IH$

Quoted 1 line

https://urldefense.com/v3/__http://lists.infradead.org/mailman/listinfo/linux-mediatek__;!!CTRNKA9wMg0ARbw!125dmOZ7xCLkwbIrzZf1VqVLQBbdT4RFHoMjR38U1GeCxaTM6xvvB-mSr7sTc6BuY5IH$

Quoted 1 line
Signature · 1 line
Jason-JH Lin <[email protected]>
#13 lore raw

Hi Tzung-Bi,

Thanks, I'll fix it.

Quoted 4 lines · Tzung-Bi Shih
Quoted 1 line · jason-jh.lin

Subject: [PATCH 0/3] Fix drm suspend and resume issue

You have 2 Subjects. The first one takes precedence.

Signature · 2 lines
Regards,
Jason-JH Lin <[email protected]>