|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [RFC 08/29] xen/arm: Add helpers to use the device tree
On Mon, 2013-04-29 at 19:23 +0100, Julien Grall wrote:
> On 04/29/2013 05:55 PM, Ian Campbell wrote:
>
> > On Mon, 2013-04-29 at 16:40 +0100, Julien Grall wrote:
> >> On 04/29/2013 04:23 PM, Ian Campbell wrote:
> >>
> >>> On Mon, 2013-04-29 at 00:01 +0100, Julien Grall wrote:
> >>>
> >>> Are these also from Linux?
> >>>
> >>>> Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
> >>>> ---
> >>>> xen/common/device_tree.c | 120
> >>>> +++++++++++++++++++++++++++++++++++++++++
> >>>> xen/include/xen/device_tree.h | 120
> >>>> +++++++++++++++++++++++++++++++++++++++++
> >>>> 2 files changed, 240 insertions(+)
> >>>>
> >>>> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> >>>> index 05285b7..dd4b813 100644
> >>>> --- a/xen/common/device_tree.c
> >>>> +++ b/xen/common/device_tree.c
> >>>> @@ -573,6 +573,54 @@ const void *dt_get_property(const struct
> >>>> dt_device_node *np,
> >>>> return pp ? pp->value : NULL;
> >>>> }
> >>>>
> >>>> +bool_t dt_device_is_compatible(const struct dt_device_node *device,
> >>>> + const char *compat)
> >>>> +{
> >>>> + const char* cp;
> >>>> + u32 cplen, l;
> >>>> +
> >>>> + cp = dt_get_property(device, "compatible", &cplen);
> >>>> + if ( cp == NULL )
> >>>> + return 0;
> >>>> + while ( cplen > 0 )
> >>>> + {
> >>>> + if ( dt_compat_cmp(cp, compat, strlen(compat)) == 0 )
> >>>
> >>> We have functions which do this already, don't we? Also things like
> >>> dt_node_cmp, dt_read_number etc have analogues in the current code.
> >>>
> >>> If these are from Linux I'm inclined to believe they will be better than
> >>> our own. For 4.4 we should look at removing our variants.
> >>>
> >>> Or maybe if I keep reading the series I will find them going away
> >>> already?
> >>
> >>
> >> In fact it's exactly the same, except the current function deals with
> >> flat device tree and the new one deals with the hierarchical device tree.
> >>
> >> I'm afraid we can't remove this duplicate code, we still need it for
> >> early scan of the device tree to retrieve memory, cpus, and modules
> >> informations.
> >
> > We can't use dt_compat_cmp in the early code?
>
> Oh right, I though you were talking about dt_device_is_compatible and
> device_tree_node_compatible.
Sorry I wasn't very clear there...
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |