From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5090DC433EF for ; Sun, 28 Nov 2021 15:53:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C7A06F50F; Sun, 28 Nov 2021 15:53:58 +0000 (UTC) Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by gabe.freedesktop.org (Postfix) with ESMTPS id D1FCA6F50F for ; Sun, 28 Nov 2021 15:53:56 +0000 (UTC) X-UUID: 03d88eb426184f58abd998b5af1e9bd0-20211128 X-UUID: 03d88eb426184f58abd998b5af1e9bd0-20211128 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 2074660873; Sun, 28 Nov 2021 23:53:52 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 28 Nov 2021 23:53:50 +0800 Received: from mtksdccf07 (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 28 Nov 2021 23:53:50 +0800 Message-ID: <1d23de3828bf921d00079f0962c9736e3e671ee2.camel@mediatek.com> Subject: Re: FW: [PATCH 3/3] drm/mediatek: add devlink to cmdq dev From: Jason-JH Lin CC: Date: Sun, 28 Nov 2021 23:53:50 +0800 In-Reply-To: References: <20211117064158.27451-1-jason-jh.lin@mediatek.com> <20211117064158.27451-4-jason-jh.lin@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-MTK: N X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Tzung-Bi, Thanks for the reviews. > From: Linux-mediatek On > Behalf Of Tzung-Bi Shih > Sent: Thursday, November 18, 2021 1:55 PM > To: Jason-JH Lin (林睿祥) > Cc: Chun-Kuang Hu ; Philipp Zabel < > p.zabel@pengutronix.de>; Matthias Brugger ; > Jassi Brar ; David Airlie linux-mediatek@lists.infradead.org; > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > hsinyi@chromium.org; fshao@chromium.org; Nancy Lin (林欣螢) < > Nancy.Lin@mediatek.com>; Singo Chang (張興國)Singo.Chang@mediatek.com> > Subject: Re: [PATCH 3/3] drm/mediatek: add devlink to cmdq dev > > On Wed, Nov 17, 2021 at 02:41:58PM +0800, jason-jh.lin wrote: > > @@ -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; > > } > > [...] > > @@ -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)); > > > > + } > > + > > 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. > > 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 > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > > > > https://urldefense.com/v3/__http://lists.infradead.org/mailman/listinfo/linux-mediatek__;!!CTRNKA9wMg0ARbw!125dmOZ7xCLkwbIrzZf1VqVLQBbdT4RFHoMjR38U1GeCxaTM6xvvB-mSr7sTc6BuY5IH$ > https://urldefense.com/v3/__http://lists.infradead.org/mailman/listinfo/linux-mediatek__;!!CTRNKA9wMg0ARbw!125dmOZ7xCLkwbIrzZf1VqVLQBbdT4RFHoMjR38U1GeCxaTM6xvvB-mSr7sTc6BuY5IH$ > https://urldefense.com/v3/__http://lists.infradead.org/mailman/listinfo/linux-mediatek__;!!CTRNKA9wMg0ARbw!125dmOZ7xCLkwbIrzZf1VqVLQBbdT4RFHoMjR38U1GeCxaTM6xvvB-mSr7sTc6BuY5IH$ > -- Jason-JH Lin