Re: [PATCH 5/8] of: Add of_graph_get_port_by_id function

From: Philipp Zabel
Date: Fri Aug 22 2014 - 08:10:17 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/