Re: [PATCH] of: implement of_device_enable_by_alias

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

 



On Mon, Jan 16, 2023 at 02:35:00PM +0100, Ahmad Fatoum wrote:
> For symmetry with of_device_disable, which already has direct, path and
> by alias variants, implement the missing of_device_enable_by alias as
> well.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
> ---
>  drivers/of/base.c | 15 +++++++++++++++
>  include/of.h      |  1 +
>  2 files changed, 16 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 9504ac47cb09..937847f44ab7 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -2789,6 +2789,21 @@ int of_device_enable_path(const char *path)
>  	return of_device_enable(node);
>  }
>  
> +/**
> + * of_device_enable_by_alias - enable a device node by alias
> + * @alias - the alias of the device tree node to enable
> + */
> +int of_device_enable_by_alias(const char *alias)
> +{
> +	struct device_node *node;
> +
> +	node = of_find_node_by_alias(NULL, alias);
> +	if (!node)
> +		return -ENODEV;
> +
> +	return of_device_enable(node);
> +}
> +
>  /**
>   * of_device_disable - disable a devicenode device
>   * @node - the node to disable
> diff --git a/include/of.h b/include/of.h
> index 4f4e9248ada9..7ee1304b932b 100644
> --- a/include/of.h
> +++ b/include/of.h
> @@ -1146,6 +1146,7 @@ extern const struct of_device_id of_default_bus_match_table[];
>  
>  int of_device_enable(struct device_node *node);
>  int of_device_enable_path(const char *path);
> +int of_device_enable_by_alias(const char *alias);
>  int of_device_disable(struct device_node *node);
>  int of_device_disable_path(const char *path);
>  int of_device_disable_by_alias(const char *alias);
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




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

  Powered by Linux