[PATCH v2 1/3] common: oftree: Add fuction to register set status fixup
Teresa Remmet
t.remmet at phytec.de
Thu Feb 25 23:52:55 PST 2016
Hello Trent,
Am Donnerstag, den 25.02.2016, 18:18 +0000 schrieb Trent Piepho:
> On Thu, 2016-02-25 at 08:36 +0100, Teresa Remmet wrote:
>
> >
> > +struct of_fixup_status_data {
> > + char *node;
>
> const char *node.
>
> I think path would be a better name, as node usually is a device_node
> pointer, not a path.
I named it node as it could also be an alias and not only a path.
But I don't might to rename it.
I'll send a fixup, also for the rest.
Regards,
Teresa
>
> > + bool status;
> > +};
> > +
> > +static int of_fixup_status(struct device_node *root, void *context)
> > +{
> > + struct of_fixup_status_data *data = context;
>
> const struct of_fixup_status_data *data
>
> > + struct device_node *node;
> > +
> > + node = of_find_node_by_path_or_alias(root, data->node);
> > + if (!node)
> > + return -ENODEV;
> > +
> > + if (data->status)
> > + return of_device_enable(node);
> > + else
> > + return of_device_disable(node);
> > +}
> > +
> > +/**
> > + * of_register_set_status_fixup - register fix up to set status of nodes
> > + * Register a fixup to enable or disable a node in the devicet tree by
> > + * passing the path or alias.
> > + */
> > +int of_register_set_status_fixup(char *node, bool status)
>
> (const char *path, bool status)
>
> > +{
> > + struct of_fixup_status_data *data;
> > +
> > + data = xzalloc(sizeof(*data));
> > + data->node = node;
> > + data->status = status;
> > +
> > + return of_register_fixup(of_fixup_status, (void *)data);
> > +}
More information about the barebox
mailing list