How to handle named resources with DT?

Arnd Bergmann arnd at arndb.de
Fri Aug 12 10:35:42 EDT 2011


On Friday 12 August 2011, Felipe Balbi wrote:
> On Fri, Aug 12, 2011 at 01:02:18PM +1000, David Gibson wrote:
> 
> the whole point of using *byname() is for the driver to not care about
> the order of the resources. So if driver has to provided an ordered list
> of names, what's the benefit ? Sounds really stupid to provide an
> ordered list of names to an ordered list of resources, just to use
> *byname() instead of just assuming the list of resources is already
> ordered.

It only make sense for drivers that support both device tree probing
and legacy probing of static platform devices.

Note how almost all drivers use only platform_get_resource and not
platform_get_resource_byname:

arnd at ocdc-kvm:~/linux-arm$ git grep -wl platform_get_resource | wc -l
565
arnd at ocdc-kvm:~/linux-arm$ git grep -wl platform_get_resource_byname | wc -l
41
arnd at ocdc-kvm:~/linux-arm$ git grep -wl platform_get_resource_byname | xargs grep -wL platform_get_resource | wc -l # both
28
arnd at ocdc-kvm:~/linux-arm$ git grep -wl platform_get_resource_byname | xargs grep -wl platform_get_resource  | wc -l # only _byname
13

I think it's much easier to change the existing users of _byname over
to fixed indexes than to come up with a new scheme that is better.

	Arnd



More information about the linux-arm-kernel mailing list