Re: [PATCH v2 1/3] common: oftree: Add fuction to register set status fixup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

> +	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);
> +}
_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux