Hi, On Tue, Jun 18, 2013 at 11:24:40AM +0200, Sebastian Andrzej Siewior wrote: > On 06/18/2013 10:54 AM, Felipe Balbi wrote: > > Hi, > > Hi Felipe, > > >> This isn't exactly a child node, is it? There is > >> of_get_child_count() but this isn't a child, it is one property. > > > > is it because we haven't added DTS support for musb core ? > > Eventually we can/should add and convert this to > > of_get_child_count() then. For now, we can go ahead with your > > approach. > > mother { > child1 { > }; > child1 { > }; > }; > > That would be a child imho. > For counting of phandles (for the number of assigned gpios for instance) > you would use > of_count_phandle_with_args(node, "gpios", "#gpio-cell-size"); > > We don't have an equivalent for "#gpio-cell-size". In our case it would > be the sum of "#address-cells" and "#size-cells" minus 1 because we > don't have a phandle and abuse a function :) > Counting the number of "addresses" is special since bother its > members (address and size) can be either 32bit or 64bit in size. > > > We have such a large amount of function pointers to sort out anyway > > :-( > > If you want get the while() loop replaced by something else I have a > few suggestions: > - check for iomem(2). If it is there we have two instances. If not, > just 1. This includes also the hope that we don't get a third port. > > - loop over of_address_to_resource(). This is what of_device_alloc() is > doing: > if (of_can_translate_address(np)) > while (of_address_to_resource(np, num_reg, &temp_res) == 0) > num_reg++; > So it is different. let's keep it as it is, I think once we convert musb-core to dt, all those issues will vanish and we will be able to use of_get_child_count() anyway. Forget my noise :-) -- balbi
Attachment:
signature.asc
Description: Digital signature