[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1408709398.1274.17.camel@paszta.hi.pengutronix.de>
Date: Fri, 22 Aug 2014 14:09:58 +0200
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc: linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
devel@...verdev.osuosl.org, Grant Likely <grant.likely@...aro.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Guennadi Liakhovetski <g.liakhovetski@....de>,
Mauro Carvalho Chehab <m.chehab@...sung.com>,
Russell King <rmk+kernel@....linux.org.uk>,
kernel@...gutronix.de
Subject: Re: [PATCH 5/8] of: Add of_graph_get_port_by_id function
Hi Laurent,
Thank you for the comments.
Am Mittwoch, den 20.08.2014, 22:13 +0200 schrieb Laurent Pinchart:
[...]
> > + struct device_node *port = NULL;
> > + int port_id;
> > +
> > + while (true) {
> > + port = of_get_next_child(node, port);
> > + if (!port)
> > + return NULL;
> > + if (of_node_cmp(port->name, "port") != 0)
> > + continue;
> > + if (of_property_read_u32(port, "reg", &port_id)) {
> > + if (!id)
> > + return port;
> > + } else {
> > + if (id == port_id)
> > + return port;
> > + }
>
> Nitpicking here, I would have written this
>
> int port_id = 0;
>
> port = of_get_next_child(node, port);
> if (!port)
> return NULL;
> if (of_node_cmp(port->name, "port") != 0)
> continue;
> of_property_read_u32(port, "reg", &port_id);
> if (id == port_id)
> return port;
>
> That saves 8 bytes with my ARM cross-compiler (at the expense of using two
> extra local registers).
>
> Please free to ignore this is you find your code layout easier to read.
No, that does look sensible to me. I'll follow your suggestions and
resend the series.
regards
Philipp
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists