|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH V2 08/33] xen/arm: Add helpers to use the device tree
On 05/08/2013 02:18 PM, Ian Campbell wrote:
> On Wed, 2013-05-08 at 03:33 +0100, Julien Grall wrote:
>> Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
>>
>> Changes in v2:
>> - use dt_node_cmp and dt_compat_cmp in early device tree code
>> ---
>> xen/common/device_tree.c | 127
>> ++++++++++++++++++++++++++++++++++++++++-
>> xen/include/xen/device_tree.h | 120 ++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 245 insertions(+), 2 deletions(-)
>>
>> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
>> index bdf8871..449c332 100644
>> --- a/xen/common/device_tree.c
>> +++ b/xen/common/device_tree.c
>> @@ -88,20 +88,23 @@ bool_t device_tree_type_matches(const void *fdt, int
>> node, const char *match)
>> if ( prop == NULL )
>> return 0;
>>
>> - return !strcmp(prop, match);
>> + return !dt_node_cmp(prop, match);
>> }
>>
>> bool_t device_tree_node_compatible(const void *fdt, int node, const char
>> *match)
>
> Aside: I wonder if any of these should be __init...
I think yes.
>
>> {
>> int len, l;
>> + int mlen;
>> const void *prop;
>>
>> + mlen = strlen(match);
>> +
>> prop = fdt_getprop(fdt, node, "compatible", &len);
>> if ( prop == NULL )
>> return 0;
>>
>> while ( len > 0 ) {
>> - if ( !strcmp(prop, match) )
>> + if ( !dt_compat_cmp(prop, match, mlen) )
>
> Is there a change in behaviour here where strlen(match) < strlen(prop)?
>
> I may be mistaken but I think match=="foo" would be compatible with a
> node "foobar" now whereas it wasn't before.
I have checked the linux code and the also use strncmp with the length
of "match"/"compatible".
> On the otherhand this is the same behaviour as dt_device_is_compatible
> so maybe it is expected. I seem to recall some name matching code which
> explicitly wanted to handle foo@0 as matching foo and things, not sure
> that applies here though.
This behaviour only happens for the compatible node.
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |