On 2015/11/21 1:30, Stefano Stabellini wrote: >> +struct xen_node_info { >> > + const char *compat; >> > + const char *prefix; >> > + const char *version; >> > + bool found; >> > +}; >> > + >> > +static int __init fdt_find_xen_node(unsigned long node, const char *uname, >> > + int depth, void *data) >> > +{ >> > + struct xen_node_info *info = data; >> > + const void *s = NULL; >> > + int len; >> > + >> > + if (depth != 1 || strcmp(uname, "hypervisor") != 0) >> > + return 0; >> > + >> > + if (of_flat_dt_is_compatible(node, info->compat)) >> > + info->found = true; >> > + >> > + s = of_get_flat_dt_prop(node, "compatible", &len); >> > + if (strlen(info->prefix) + 3 < len && >> > + !strncmp(info->prefix, s, strlen(info->prefix))) >> > + info->version = s + strlen(info->prefix); >> > + return 0; >> > +} >> > + >> > /* >> > * see Documentation/devicetree/bindings/arm/xen.txt for the >> > * documentation of the Xen Device Tree format. >> > @@ -149,26 +176,25 @@ static irqreturn_t xen_arm_callback(int irq, void *arg) >> > #define GRANT_TABLE_PHYSADDR 0 >> > void __init xen_early_init(void) >> > { >> > - int len; >> > - const char *s = NULL; >> > - const char *version = NULL; >> > - const char *xen_prefix = "xen,xen-"; >> > + struct xen_node_info info; >> > + >> > + info.compat = "xen,xen"; >> > + info.prefix = "xen,xen-"; >> > + info.version = NULL; >> > + info.found = false; > Can you initialize the fields directly when you define xen_node_info and > make it static? Sure. Thanks, -- Shannon -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html