dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Daniel Kurtz <djkurtz@chromium.org>
Cc: kernel@pengutronix.de,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Grant Likely <grant.likely@linaro.org>,
	Mark Yao <mark.yao@rock-chips.com>
Subject: Re: [PATCH 4/4] drm/rockchip: use for_each_endpoint_of_node macro, drop endpoint reference on break
Date: Tue, 24 Feb 2015 10:24:31 +0100	[thread overview]
Message-ID: <1424769871.3957.11.camel@pengutronix.de> (raw)
In-Reply-To: <CAGS+omCWpuzEgO_RazuT5s-vRRbA3zVzWaoiYN8R4AH75RTB_Q@mail.gmail.com>

Hi Daniel,

thank you for the review!

Am Dienstag, den 24.02.2015, 11:13 +0800 schrieb Daniel Kurtz:
> > @@ -375,18 +375,15 @@ int rockchip_drm_encoder_get_mux_id(struct device_node *node,
> >         if (!node || !crtc)
> >                 return -EINVAL;
> >
> > -       do {
> > -               ep = of_graph_get_next_endpoint(node, ep);
> > -               if (!ep)
> > -                       break;
> > -
> > +       for_each_endpoint_of_node(node, ep) {
> >                 port = of_graph_get_remote_port(ep);
> >                 of_node_put(port);
> 
> Shouldn't we put port after comparing it to crtc->port?

We don't dereference the pointer. It is only compared to crtc->port in
the line below, so this should be fine.

> This looks like an existing issue, though so this patch is (assuming
> the series [0] is merged):
> 
> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
>
> [0] https://lkml.org/lkml/2015/2/23/115
> 
> >
> >                 if (port == crtc->port) {
> >                         ret = of_graph_parse_endpoint(ep, &endpoint);
> > +                       of_node_put(ep);
> >                         return ret ?: endpoint.id;
> 
> This function looks really similar to imx_drm_encoder_get_mux_id().

Good point.

> The only difference is that it looks up endpoint.id rather than endpoint.port.
>
> Is there any way we can resolve this slight difference so that both
> can use a single common helper?

The way I see it, the ports describe the physical inputs to the mux, so
the port number should be used to determine the mux setting. In theory
there could be multiple endpoints (multiple sources on the same bus
connected to a single mux input), so I wouldn't like to change imx-drm
to determine the mux setting from endpoint ids.
Could we change the rockchip driver to use the port id instead?

> Or, at least move both of them to somewhere more generic?

There's drm_of_find_possible_crtcs already, we could add
drm_of_encoder_get_port_id and possibly drm_of_encoder_get_endpoint_id
next to it.

regards
Philipp

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2015-02-24  9:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23 16:34 [PATCH 0/4] drm: use for_each_endpoint_of_node macro Philipp Zabel
2015-02-23 16:34 ` [PATCH 1/4] drm: use for_each_endpoint_of_node macro in drm_of_find_possible_crtcs Philipp Zabel
2015-02-23 16:34 ` [PATCH 2/4] drm/imx: use for_each_endpoint_of_node macro in imx_drm_encoder_get_mux_id Philipp Zabel
2015-02-23 16:34 ` [PATCH 3/4] drm/rcar-du: use for_each_endpoint_of_node macro Philipp Zabel
2015-02-23 17:00   ` Laurent Pinchart
2015-02-23 16:34 ` [PATCH 4/4] drm/rockchip: use for_each_endpoint_of_node macro, drop endpoint reference on break Philipp Zabel
2015-02-24  3:13   ` Daniel Kurtz
2015-02-24  9:24     ` Philipp Zabel [this message]

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=1424769871.3957.11.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=djkurtz@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=grant.likely@linaro.org \
    --cc=kernel@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=mark.yao@rock-chips.com \
    /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