From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Peter Rosin <peda@axentia.se>
Cc: Mark Rutland <mark.rutland@arm.com>,
devicetree@vger.kernel.org, jmondi <jacopo@jmondi.org>,
David Airlie <airlied@linux.ie>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
dri-devel <dri-devel@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Sakari Ailus <sakari.ailus@iki.fi>, Jyri Sarha <jsarha@ti.com>,
Jacopo Mondi <jacopo+renesas@jmondi.org>,
Russell King <linux@armlinux.org.uk>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v8 3/4] drm/atmel-hlcdc: iterate over all output endpoints
Date: Fri, 24 Aug 2018 09:47:01 +0200 [thread overview]
Message-ID: <20180824094701.1f17393f@bbrezillon> (raw)
In-Reply-To: <56016787-0487-1571-7c28-2767033cda23@axentia.se>
On Tue, 14 Aug 2018 17:05:29 +0200
Peter Rosin <peda@axentia.se> wrote:
> >>>>>> @@ -77,13 +79,29 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint)
> >>>>>>
> >>>>>> int atmel_hlcdc_create_outputs(struct drm_device *dev)
> >>>>>> {
> >>>>>> - int endpoint, ret = 0;
> >>>>>> -
> >>>>>> - for (endpoint = 0; !ret; endpoint++)
> >>>>>> - ret = atmel_hlcdc_attach_endpoint(dev, endpoint);
> >>>>>> + struct of_endpoint endpoint;
> >>>>>> + struct device_node *node = NULL;
> >>>>>> + int count = 0;
> >>>>>> + int ret = 0;
> >>>>>> +
> >>>>>> + for_each_endpoint_of_node(dev->dev->of_node, node) {
> >>>>>> + of_graph_parse_endpoint(node, &endpoint);
> >>>
> >>> I'd really like to kill off of_graph_parse_endpoint, not add more
> >>> users (check the git history on this code). You should know what are
> >>> possible port and endpoint numbers, so iterate over those.
> >>
> >> So, add a comment to that effect in the docs of the of_graph_parse_endpoint
> >> function.
> >>
> >> How can the hlcdc driver know the actual number of endpoints? It's a
> >> one-way signal path out from that port, and it can easily be routed to
> >> 1, 2, 3 or even more places. As shown above, forcing the endpoint id
> >> to start at zero is a nuisance, and I don't see the point of it.
> >>
> >> But I welcome suggestions on how to arrange the above dtsi/dts fragments
> >> in a world where the endpoint id absolutely has to start at zero.
> >
> > Your dts file arrangement seems fine. Can't you just not exit the loop
> > on -ENODEV? IOW, just iterate til you find an enabled endpoint.
>
> That would regress cases where two (or more) endpoints are enabled
> (which is currently supported). As I see it, the driver will have a
> very hard time knowing when to stop iterating with any solution not
> involving the equivalent of the functions for_each_endpoint_of_node
> and of_graph_parse_endpoint. Open-coding of_graph_parse_endpoint just
> to avoid it is a bit more than silly IMHO...
I agree, and actually, I think this is Rob who suggested to do what we
do here :-) (iterate from 0 to X, and stop as soon as
-ENODEV is returned).
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-08-24 7:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-10 13:03 [PATCH v8 0/4] drm/atmel-hlcdc: bus-width override support Peter Rosin
2018-08-10 13:03 ` [PATCH v8 1/4] dt-bindings: display: bridge: lvds-transmitter: add ti,ds90c185 Peter Rosin
2018-08-10 13:03 ` [PATCH v8 2/4] dt-bindings: display: atmel: optional video-interface of endpoints Peter Rosin
2018-08-10 13:03 ` [PATCH v8 3/4] drm/atmel-hlcdc: iterate over all output endpoints Peter Rosin
2018-08-13 13:59 ` jacopo mondi
2018-08-13 14:24 ` Peter Rosin
2018-08-13 20:52 ` Rob Herring
2018-08-14 6:35 ` Peter Rosin
2018-08-14 14:33 ` Rob Herring
2018-08-14 15:05 ` Peter Rosin
2018-08-24 7:47 ` Boris Brezillon [this message]
2018-08-24 16:33 ` Rob Herring
2018-08-10 13:03 ` [PATCH v8 4/4] drm/atmel-hlcdc: support bus-width (12/16/18/24) in endpoint nodes Peter Rosin
2018-08-24 7:51 ` [PATCH v8 0/4] drm/atmel-hlcdc: bus-width override support Boris Brezillon
2018-08-24 7:59 ` Peter Rosin
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=20180824094701.1f17393f@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=airlied@linux.ie \
--cc=alexandre.belloni@bootlin.com \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jacopo+renesas@jmondi.org \
--cc=jacopo@jmondi.org \
--cc=jsarha@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=peda@axentia.se \
--cc=robh+dt@kernel.org \
--cc=sakari.ailus@iki.fi \
/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).