* [PATCH] of: implement of_device_enable_by_alias
@ 2023-01-16 13:35 Ahmad Fatoum
2023-01-16 14:24 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-01-16 13:35 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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@pengutronix.de>
---
drivers/of/base.c | 15 +++++++++++++++
include/of.h | 1 +
2 files changed, 16 insertions(+)
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] of: implement of_device_enable_by_alias
2023-01-16 13:35 [PATCH] of: implement of_device_enable_by_alias Ahmad Fatoum
@ 2023-01-16 14:24 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-01-16 14:24 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
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@pengutronix.de>
> ---
> 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 |
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-16 14:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-16 13:35 [PATCH] of: implement of_device_enable_by_alias Ahmad Fatoum
2023-01-16 14:24 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox