public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@bootlin.com>
To: Chen-Yu Tsai <wens@csie.org>
Cc: Sean Paul <seanpaul@chromium.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v2 01/13] drm/sun4i: backend: Simplify the get_id logic
Date: Fri, 15 Mar 2019 09:38:09 +0100	[thread overview]
Message-ID: <20190315083809.xibciwfpebru5vix@flea> (raw)
In-Reply-To: <CAGb2v66K+dJwyV=ovKrKV3kMwHAs8OTF5ZetzfJ47E7=E5FXCA@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2619 bytes --]

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 <maxime.ripard@bootlin.com> wrote:
> >
> > Using the new helpers introduced since we wrote that code, we can simplify
> > 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 <maxime.ripard@bootlin.com>
> > ---
> >  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/sun4i/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 = -EINVAL;
> > +       struct device_node *ep, *remote;
> > +       struct of_endpoint of_ep;
> >
> > -       /* input is port 0 */
> > -       port = of_graph_get_port_by_id(node, 0);
> > -       if (!port)
> > +       /* Input port is 0, and we want the first endpoint. */
> > +       ep = 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 = of_graph_get_remote_endpoint(ep);
> > -               if (!remote)
> > -                       continue;
> > -
> > -               ret = of_property_read_u32(remote, "reg", &reg);
> > -               if (ret)
> > -                       continue;
> > -
> > -               ret = reg;
> > -       }
> > -
> > -       of_node_put(port);
> > +       remote = of_graph_get_remote_endpoint(ep);
> 
> 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,
> 
> Reviewed-by: Chen-Yu Tsai <wens@csie.org>

Thanks!

I've applied this on and the next and added the of_node_put in the
process.

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-03-15  8:38 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14 20:16 [PATCH v2 00/13] ARM: dts: sunxi: Cleanup DTC warnings Maxime Ripard
2019-03-14 20:16 ` [PATCH v2 01/13] drm/sun4i: backend: Simplify the get_id logic Maxime Ripard
2019-03-15  2:43   ` Chen-Yu Tsai
2019-03-15  8:38     ` Maxime Ripard [this message]
2019-03-14 20:16 ` [PATCH v2 02/13] drm/sun4i: mixer: " Maxime Ripard
2019-03-15  2:44   ` Chen-Yu Tsai
2019-03-14 20:16 ` [PATCH v2 03/13] ARM: dts: sun8i: a83t: Add cross links for the mixers Maxime Ripard
2019-03-15  2:53   ` Chen-Yu Tsai
2019-03-14 20:16 ` [PATCH v2 04/13] arm64: dts: allwinner: a64: " Maxime Ripard
2019-03-15  2:54   ` Chen-Yu Tsai
2019-03-14 20:16 ` [PATCH v2 05/13] ARM: dts: sun5i: Fix display pipeline endpoint warnings in DTC Maxime Ripard
2019-03-15  2:29   ` Chen-Yu Tsai
2019-03-14 20:16 ` [PATCH v2 06/13] ARM: dts: sun5i: Fix Display Engine DTC warnings Maxime Ripard
2019-03-15  2:30   ` Chen-Yu Tsai
2019-03-14 20:16 ` [PATCH v2 07/13] ARM: dts: sun6i: " Maxime Ripard
2019-03-15  2:29   ` Chen-Yu Tsai
2019-03-14 20:16 ` [PATCH v2 08/13] ARM: dts: sun8i: a23/a33: " Maxime Ripard
2019-03-15  2:28   ` Chen-Yu Tsai
2019-03-15  8:57     ` Maxime Ripard
2019-03-14 20:16 ` [PATCH v2 09/13] ARM: dts: sun8i: v3s: " Maxime Ripard
2019-03-15  2:32   ` Chen-Yu Tsai
2019-03-14 20:16 ` [PATCH v2 10/13] ARM: dts: sun8i: a83t: " Maxime Ripard
2019-03-15  2:34   ` Chen-Yu Tsai
2019-03-14 20:16 ` [PATCH v2 11/13] ARM: dts: sun8i: r40: " Maxime Ripard
2019-03-15  2:35   ` Chen-Yu Tsai
2019-03-14 20:16 ` [PATCH v2 12/13] ARM: dts: sun9i: " Maxime Ripard
2019-03-15  2:35   ` Chen-Yu Tsai
2019-03-14 20:16 ` [PATCH v2 13/13] ARM: dts: sun9i: Add missing unit address Maxime Ripard
2019-03-15  2:39   ` Chen-Yu Tsai
2019-03-15  9:02     ` Maxime Ripard
2019-03-15  9:09       ` Chen-Yu Tsai
2019-03-15  9:16         ` Maxime Ripard
2019-03-15 10:22           ` Chen-Yu Tsai
2019-03-15 11:58             ` Maxime Ripard
2019-03-15  9:08 ` [PATCH v2 00/13] ARM: dts: sunxi: Cleanup DTC warnings Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190315083809.xibciwfpebru5vix@flea \
    --to=maxime.ripard@bootlin.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=seanpaul@chromium.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox