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=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_NEOMUTT 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 F3F9EC43381 for ; Fri, 15 Mar 2019 08:38:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 C327221872 for ; Fri, 15 Mar 2019 08:38:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="H7VJnWN1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C327221872 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=T65RfNOv3JIhh/nHnQ+si1e645LQ4+fouBAuXAXUUYM=; b=H7VJnWN1Fs8NiSQqLGgeHVYCa 4TGHkzs4H03A0S6glOjA3oThuEjsb++NAdO02MLm0IhAuzxEK1Z87mPB8Kzx6YFV6d/HRM5Wpsnup pxg+r/VJYyuaN+BvRY2ANdeh7qGcS2lI56CY3nZWfj2a/YtRqnKPLLHHXJFEoUCdH4FxUzeHbEoVG F7o+n7CHqeNM3VQubDs8oEMJn8QrzOilyLDdqeXCjR1aaSURCl4kcv8smBRTDO3/rbB0AGy67Fb7g 5iV8m31yWqWv4OJQB8lAIkj+/H+TdwSv7Dud35oX76WuF8nsSOYMc79iSHTSjtfjjoFT2EhBlpMCv dDoAHnfBA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4iM9-0004Eq-N5; Fri, 15 Mar 2019 08:38:21 +0000 Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4iM5-0004E7-Pc for linux-arm-kernel@lists.infradead.org; Fri, 15 Mar 2019 08:38:20 +0000 X-Originating-IP: 90.88.22.102 Received: from localhost (aaubervilliers-681-1-80-102.w90-88.abo.wanadoo.fr [90.88.22.102]) (Authenticated sender: maxime.ripard@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 61B43240016; Fri, 15 Mar 2019 08:38:09 +0000 (UTC) Date: Fri, 15 Mar 2019 09:38:09 +0100 From: Maxime Ripard To: Chen-Yu Tsai Subject: Re: [PATCH v2 01/13] drm/sun4i: backend: Simplify the get_id logic Message-ID: <20190315083809.xibciwfpebru5vix@flea> References: <1a9bf911b0a40475da8025859032514131d5397b.1552594551.git-series.maxime.ripard@bootlin.com> MIME-Version: 1.0 In-Reply-To: User-Agent: NeoMutt/20180716 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190315_013818_133428_C1B033AB X-CRM114-Status: GOOD ( 20.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Paul , Maarten Lankhorst , linux-arm-kernel , dri-devel Content-Type: multipart/mixed; boundary="===============8110086734064022828==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============8110086734064022828== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fw6froabzxkpk2gu" Content-Disposition: inline --fw6froabzxkpk2gu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 15, 2019 at 10:43:48AM +0800, Chen-Yu Tsai wrote: > On Fri, Mar 15, 2019 at 4:16 AM Maxime Ripard = wrote: > > > > Using the new helpers introduced since we wrote that code, we can simpl= ify > > the code to retrieve the backend ID significantly. > > > > The new code will also allow us to deal nicely with endpoints that don't > > have a reg property, as expected in the case where there's a single > > endpoint for a given port. > > > > Signed-off-by: Maxime Ripard > > --- > > drivers/gpu/drm/sun4i/sun4i_backend.c | 34 +++++++++------------------- > > 1 file changed, 11 insertions(+), 23 deletions(-) > > > > diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/su= n4i/sun4i_backend.c > > index 4c0d51f73237..02ef8e455db8 100644 > > --- a/drivers/gpu/drm/sun4i/sun4i_backend.c > > +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c > > @@ -720,33 +720,21 @@ static int sun4i_backend_free_sat(struct device *= dev) { > > */ > > static int sun4i_backend_of_get_id(struct device_node *node) > > { > > - struct device_node *port, *ep; > > - int ret =3D -EINVAL; > > + struct device_node *ep, *remote; > > + struct of_endpoint of_ep; > > > > - /* input is port 0 */ > > - port =3D of_graph_get_port_by_id(node, 0); > > - if (!port) > > + /* Input port is 0, and we want the first endpoint. */ > > + ep =3D of_graph_get_endpoint_by_regs(node, 0, -1); > > + if (!ep) > > return -EINVAL; > > > > - /* try finding an upstream endpoint */ > > - for_each_available_child_of_node(port, ep) { > > - struct device_node *remote; > > - u32 reg; > > - > > - remote =3D of_graph_get_remote_endpoint(ep); > > - if (!remote) > > - continue; > > - > > - ret =3D of_property_read_u32(remote, "reg", ®); > > - if (ret) > > - continue; > > - > > - ret =3D reg; > > - } > > - > > - of_node_put(port); > > + remote =3D of_graph_get_remote_endpoint(ep); >=20 > I believe you also need to call of_node_put for ep? Ah, right. It wasn't mentionned in the doc, but you definitely need it. I'll send a patch for that. > Otherwise, >=20 > Reviewed-by: Chen-Yu Tsai Thanks! I've applied this on and the next and added the of_node_put in the process. Maxime --=20 Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --fw6froabzxkpk2gu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXItkcQAKCRDj7w1vZxhR xY7nAQDFvx/3Uv6gGOM9blyjQtBCizVaKRDj86pZ173LLIfptAD/XAoIeMeAgZOs NKICLNzETTTytrzQjN8CJ0NzwY4OQA4= =/r7J -----END PGP SIGNATURE----- --fw6froabzxkpk2gu-- --===============8110086734064022828== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============8110086734064022828==--