From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] of: implement of_device_enable_by_alias
Date: Mon, 16 Jan 2023 14:35:00 +0100 [thread overview]
Message-ID: <20230116133500.1998550-1-a.fatoum@pengutronix.de> (raw)
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
next reply other threads:[~2023-01-16 13:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-16 13:35 Ahmad Fatoum [this message]
2023-01-16 14:24 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230116133500.1998550-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox