Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8395C433EF for ; Sun, 12 Sep 2021 19:46:52 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6331960F6F for ; Sun, 12 Sep 2021 19:46:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6331960F6F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8E74E89DD2; Sun, 12 Sep 2021 19:46:51 +0000 (UTC) Received: from mx2.smtp.larsendata.com (mx2.smtp.larsendata.com [91.221.196.228]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8B62C89DD2 for ; Sun, 12 Sep 2021 19:46:50 +0000 (UTC) Received: from mail01.mxhotel.dk (mail01.mxhotel.dk [91.221.196.236]) by mx2.smtp.larsendata.com (Halon) with ESMTPS id 2475cd5e-1402-11ec-9416-0050568cd888; Sun, 12 Sep 2021 19:46:37 +0000 (UTC) Received: from ravnborg.org (80-162-45-141-cable.dk.customer.tdc.net [80.162.45.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sam@ravnborg.org) by mail01.mxhotel.dk (Postfix) with ESMTPSA id 63706194BEF; Sun, 12 Sep 2021 21:46:40 +0200 (CEST) Date: Sun, 12 Sep 2021 21:46:46 +0200 X-Report-Abuse-To: abuse@mxhotel.dk From: Sam Ravnborg To: Maxime Ripard Cc: Robert Foss , Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Laurent Pinchart , Jernej Skrabec , Andrzej Hajda , Neil Armstrong , Jonas Karlman , dri-devel@lists.freedesktop.org Subject: Re: [PATCH 3/3] drm/vc4: dsi: Switch to devm_drm_of_get_bridge Message-ID: References: <20210910130941.1740182-1-maxime@cerno.tech> <20210910130941.1740182-4-maxime@cerno.tech> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210910130941.1740182-4-maxime@cerno.tech> 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" On Fri, Sep 10, 2021 at 03:09:41PM +0200, Maxime Ripard wrote: > The new devm_drm_of_get_bridge removes most of the boilerplate we > have to deal with. Let's switch to it. > > Signed-off-by: Maxime Ripard With the includes updated: Acked-by: Sam Ravnborg Sam > --- > drivers/gpu/drm/vc4/vc4_drv.c | 2 ++ > drivers/gpu/drm/vc4/vc4_dsi.c | 28 ++++------------------------ > 2 files changed, 6 insertions(+), 24 deletions(-) > > diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c > index 16abc3a3d601..96c526f1022e 100644 > --- a/drivers/gpu/drm/vc4/vc4_drv.c > +++ b/drivers/gpu/drm/vc4/vc4_drv.c > @@ -25,7 +25,9 @@ > #include > #include > #include > +#include I fail to see why this include is needed? > #include > +#include I think this should be drm_bridge.h. And drm_bridge.h hopefully pulls in what is needed. > #include > #include > #include > diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c > index a185027911ce..a229da58962a 100644 > --- a/drivers/gpu/drm/vc4/vc4_dsi.c > +++ b/drivers/gpu/drm/vc4/vc4_dsi.c > @@ -1497,7 +1497,6 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) > struct drm_device *drm = dev_get_drvdata(master); > struct vc4_dsi *dsi = dev_get_drvdata(dev); > struct vc4_dsi_encoder *vc4_dsi_encoder; > - struct drm_panel *panel; > const struct of_device_id *match; > dma_cap_mask_t dma_mask; > int ret; > @@ -1609,27 +1608,9 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) > return ret; > } > > - ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, > - &panel, &dsi->bridge); > - if (ret) { > - /* If the bridge or panel pointed by dev->of_node is not > - * enabled, just return 0 here so that we don't prevent the DRM > - * dev from being registered. Of course that means the DSI > - * encoder won't be exposed, but that's not a problem since > - * nothing is connected to it. > - */ > - if (ret == -ENODEV) > - return 0; > - > - return ret; > - } > - > - if (panel) { > - dsi->bridge = devm_drm_panel_bridge_add_typed(dev, panel, > - DRM_MODE_CONNECTOR_DSI); > - if (IS_ERR(dsi->bridge)) > - return PTR_ERR(dsi->bridge); > - } > + dsi->bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0); > + if (IS_ERR(dsi->bridge)) > + return PTR_ERR(dsi->bridge); > > /* The esc clock rate is supposed to always be 100Mhz. */ > ret = clk_set_rate(dsi->escape_clock, 100 * 1000000); > @@ -1667,8 +1648,7 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master, > { > struct vc4_dsi *dsi = dev_get_drvdata(dev); > > - if (dsi->bridge) > - pm_runtime_disable(dev); > + pm_runtime_disable(dev); > > /* > * Restore the bridge_chain so the bridge detach procedure can happen > -- > 2.31.1