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 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 84730C433EF for ; Sun, 12 Sep 2021 19:43:00 +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 4043F60F9F for ; Sun, 12 Sep 2021 19:43:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4043F60F9F 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 871E089C1F; Sun, 12 Sep 2021 19:42:59 +0000 (UTC) Received: from mx2.smtp.larsendata.com (mx2.smtp.larsendata.com [91.221.196.228]) by gabe.freedesktop.org (Postfix) with ESMTPS id CDEED89C1F for ; Sun, 12 Sep 2021 19:42:57 +0000 (UTC) Received: from mail01.mxhotel.dk (mail01.mxhotel.dk [91.221.196.236]) by mx2.smtp.larsendata.com (Halon) with ESMTPS id 9973ecc9-1401-11ec-9416-0050568cd888; Sun, 12 Sep 2021 19:42:44 +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 33C8C194C71; Sun, 12 Sep 2021 21:42:47 +0200 (CEST) Date: Sun, 12 Sep 2021 21:42:53 +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 2/3] drm/vc4: dpi: Switch to devm_drm_of_get_bridge Message-ID: References: <20210910130941.1740182-1-maxime@cerno.tech> <20210910130941.1740182-3-maxime@cerno.tech> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210910130941.1740182-3-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:40PM +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 Acked-by: Sam Ravnborg > --- > drivers/gpu/drm/vc4/vc4_dpi.c | 15 ++++----------- > 1 file changed, 4 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c > index a90f2545baee..c180eb60bee8 100644 > --- a/drivers/gpu/drm/vc4/vc4_dpi.c > +++ b/drivers/gpu/drm/vc4/vc4_dpi.c > @@ -229,26 +229,19 @@ static const struct of_device_id vc4_dpi_dt_match[] = { > static int vc4_dpi_init_bridge(struct vc4_dpi *dpi) > { > struct device *dev = &dpi->pdev->dev; > - struct drm_panel *panel; > struct drm_bridge *bridge; > - int ret; > > - ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, > - &panel, &bridge); > - if (ret) { > + bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0); > + if (IS_ERR(bridge)) { > /* If nothing was connected in the DT, that's not an > * error. > */ > - if (ret == -ENODEV) > + if (PTR_ERR(bridge) == -ENODEV) > return 0; > else > - return ret; > + return PTR_ERR(bridge); > } > > - if (panel) > - bridge = drm_panel_bridge_add_typed(panel, > - DRM_MODE_CONNECTOR_DPI); > - > return drm_bridge_attach(dpi->encoder, bridge, NULL, 0); > } > > -- > 2.31.1