devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Chen-Yu Tsai <wens@csie.org>,
	dri-devel@lists.freedesktop.org,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Daniel Vetter <daniel.vetter@intel.com>,
	David Airlie <airlied@linux.ie>,
	devicetree@vger.kernel.org, Mark Rutland <mark.rutland@arm.com>,
	Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH RESEND v3 1/6] drm/of: Change the prototype of drm_of_lvds_get_dual_link_pixel_order
Date: Tue, 26 Jan 2021 16:10:22 +0200	[thread overview]
Message-ID: <YBAiztjg0Jji9voK@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20201118174805.cm67sluusovz5n6a@gilmour.lan>

Hi Maxime,

On Wed, Nov 18, 2020 at 06:48:05PM +0100, Maxime Ripard wrote:
> On Mon, Oct 12, 2020 at 02:00:30AM +0300, Laurent Pinchart wrote:
> > > -static int drm_of_lvds_get_remote_pixels_type(
> > > -			const struct device_node *port_node)
> > > +static int drm_of_lvds_get_remote_pixels_type(const struct device_node *endpoint)
> > >  {
> > > -	struct device_node *endpoint = NULL;
> > > -	int pixels_type = -EPIPE;
> > > +	struct device_node *remote_port;
> > > +	int pixels_type;
> > >  
> > > -	for_each_child_of_node(port_node, endpoint) {
> > > -		struct device_node *remote_port;
> > > -		int current_pt;
> > > -
> > > -		if (!of_node_name_eq(endpoint, "endpoint"))
> > > -			continue;
> > > -
> > > -		remote_port = of_graph_get_remote_port(endpoint);
> > > -		if (!remote_port) {
> > > -			of_node_put(remote_port);
> > > -			return -EPIPE;
> > > -		}
> > > -
> > > -		current_pt = drm_of_lvds_get_port_pixels_type(remote_port);
> > > +	remote_port = of_graph_get_remote_port(endpoint);
> > > +	if (!remote_port) {
> > >  		of_node_put(remote_port);
> > 
> > You can drop this line.
> > 
> > > -		if (pixels_type < 0)
> > > -			pixels_type = current_pt;
> > > -
> > > -		/*
> > > -		 * Sanity check, ensure that all remote endpoints have the same
> > > -		 * pixel type. We may lift this restriction later if we need to
> > > -		 * support multiple sinks with different dual-link
> > > -		 * configurations by passing the endpoints explicitly to
> > > -		 * drm_of_lvds_get_dual_link_pixel_order().
> > > -		 */
> > 
> > Shouldn't we keep this check when endpoint_id is -1 in
> > drm_of_lvds_get_dual_link_pixel_order() ?
> 
> I tried to do that, and I'm not quite really sure how to go around it.
> 
> This scans all the endpoints in a given port.
> 
> However, now that we have the device, port id and endpoint id, we need
> to use of_graph_get_port_by_id to get the port matching the device and
> port id, and iterate over all its endpoint as done here.
> 
> The trouble is that of_graph_get_port_by_id expects a !const
> device_node, yet drm_of_lvds_get_dual_link_pixel_order (and seems to be
> doing so rightfully), so that creates a warning because we drop the
> const there.

of_graph_get_port_by_id() doesn't seem to modify the device_node passed
to it, couldn't it be modified to take a const pointer ?

> Changing the prototype to passing only the port device_node doesn't
> really work either, since it would be const, and we would need to call
> of_graph_get_endpoint_by_regs (so having the parent device_node, through
> of_graph_get_port_parent) and of_graph_get_port_parent takes a !const
> port device_node.
> 
> I guess we could drop const entirely from our function, but that doesn't
> look right either..

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2021-01-26 14:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 15:15 [PATCH RESEND v3 0/6] drm/sun4i: Add support for dual-link LVDS on the A20 Maxime Ripard
2020-10-05 15:15 ` [PATCH RESEND v3 1/6] drm/of: Change the prototype of drm_of_lvds_get_dual_link_pixel_order Maxime Ripard
2020-10-11 23:00   ` Laurent Pinchart
2020-11-18 17:48     ` Maxime Ripard
2021-01-26 14:10       ` Laurent Pinchart [this message]
2020-10-05 15:15 ` [PATCH RESEND v3 2/6] dt-bindings: display: sun4i: Add LVDS Dual-Link property Maxime Ripard
2020-10-07 15:50   ` Rob Herring
2020-10-05 15:15 ` [PATCH RESEND v3 3/6] drm/sun4i: tcon: Refactor the LVDS and panel probing Maxime Ripard
2020-10-05 15:15 ` [PATCH RESEND v3 4/6] drm/sun4i: tcon: Support the LVDS Dual-Link Maxime Ripard
2020-10-09 15:23   ` Chen-Yu Tsai
2020-10-05 15:15 ` [PATCH RESEND v3 5/6] drm/sun4i: tcon: Enable the A20 dual-link output Maxime Ripard
2020-10-09 15:20   ` Chen-Yu Tsai
2020-10-05 15:15 ` [PATCH RESEND v3 6/6] [DO NOT MERGE] ARM: dts: sun7i: Enable LVDS Dual-Link on the Cubieboard 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=YBAiztjg0Jji9voK@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mark.rutland@arm.com \
    --cc=maxime@cerno.tech \
    --cc=robh+dt@kernel.org \
    --cc=tzimmermann@suse.de \
    --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;
as well as URLs for NNTP newsgroup(s).