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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux