From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v3 2/4] environment: implement of_env_get_device_alias_by_path helper
Date: Mon, 2 Dec 2024 12:24:35 +0100 [thread overview]
Message-ID: <20241202112437.535013-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20241202112437.535013-1-a.fatoum@pengutronix.de>
For use by board-code that wants to get the alias pointing at the
backing device of an environment node add a simple
of_env_get_device_alias_by_path() helper, so board code doesn't need to
worry about property name and whether the binding uses a phandle or
string path.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v2 -> v3:
- rename from of_env_get_alias_by_path to of_env_get_device_alias_by_path
v1 -> v2:
- no change
---
drivers/of/barebox.c | 5 +++++
include/envfs.h | 10 ++++++++++
2 files changed, 15 insertions(+)
diff --git a/drivers/of/barebox.c b/drivers/of/barebox.c
index 85e356f5ac0f..dc90c0cb3ada 100644
--- a/drivers/of/barebox.c
+++ b/drivers/of/barebox.c
@@ -15,6 +15,11 @@
#define ENV_MNT_DIR "/boot" /* If env on filesystem, where to mount */
+const char *of_env_get_device_alias_by_path(const char *of_path)
+{
+ return of_property_get_alias(of_path, "device-path");
+}
+
static char *environment_probe_1node_binding(struct device *dev)
{
struct cdev *cdev;
diff --git a/include/envfs.h b/include/envfs.h
index 767b34c943de..a6614c0a15ee 100644
--- a/include/envfs.h
+++ b/include/envfs.h
@@ -118,6 +118,16 @@ static inline const char *default_environment_path_get(void)
}
#endif
+#ifdef CONFIG_OF_BAREBOX_DRIVERS
+const char *of_env_get_device_alias_by_path(const char *of_path);
+#else
+static inline const char *of_env_get_device_alias_by_path(const char *of_path)
+{
+ return NULL;
+}
+#endif
+
+
#ifdef CONFIG_DEFAULT_ENVIRONMENT
void defaultenv_append(void *buf, unsigned int size, const char *name);
int defaultenv_load(const char *dir, unsigned flags);
--
2.39.5
next prev parent reply other threads:[~2024-12-02 11:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 11:24 [PATCH v3 1/4] of: add helpers to get alias from device node path + property name Ahmad Fatoum
2024-12-02 11:24 ` Ahmad Fatoum [this message]
2024-12-02 11:24 ` [PATCH v3 3/4] bootsource: have bootsource_get_alias_name return const char * Ahmad Fatoum
2024-12-02 11:24 ` [PATCH v3 4/4] ARM: i.MX8MP: tqma8mpxl: fix bbu registration for other boards using SoM Ahmad Fatoum
2024-12-02 12:39 ` [PATCH v3 1/4] of: add helpers to get alias from device node path + property name 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=20241202112437.535013-2-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