From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: h.assmann@pengutronix.de
Subject: Re: [PATCH v2 2/4] environment: implement of_env_get_alias_by_path helper
Date: Fri, 15 Nov 2024 13:38:03 +0100 [thread overview]
Message-ID: <970fb560-b4f5-4c3b-9d5e-cd7b243707c3@pengutronix.de> (raw)
In-Reply-To: <20241115121602.3999375-2-a.fatoum@pengutronix.de>
On 15.11.24 13:16, Ahmad Fatoum wrote:
> 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_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>
Thinking about it, of_env_get_device_alias_by_path may be a bit verbose,
but is a better name.
I'll wait for more feedback before sending v3 though.
Cheers,
Ahmad
> ---
> 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 ed5d171e43a8..7d433e280ba5 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_alias_by_path(const char *of_path)
> +{
> + return of_property_get_alias(of_path, "device-path");
> +}
> +
> /* If dev describes a file on a fs, mount the fs and return a pointer
> * to the file's path. Otherwise return an error code or NULL if the
> * device path should be used.
> diff --git a/include/envfs.h b/include/envfs.h
> index 767b34c943de..8bfc83b6b008 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_alias_by_path(const char *of_path);
> +#else
> +static inline const char *of_env_get_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);
--
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 |
next prev parent reply other threads:[~2024-11-15 12:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-15 12:15 [PATCH v2 1/4] of: add helpers to get alias from device node path + property name Ahmad Fatoum
2024-11-15 12:16 ` [PATCH v2 2/4] environment: implement of_env_get_alias_by_path helper Ahmad Fatoum
2024-11-15 12:38 ` Ahmad Fatoum [this message]
2024-11-15 12:16 ` [PATCH v2 3/4] bootsource: have bootsource_get_alias_name return const char * Ahmad Fatoum
2024-11-15 12:16 ` [PATCH v2 4/4] ARM: i.MX8MP: tqma8mpxl: fix bbu registration for other boards using SoM Ahmad Fatoum
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=970fb560-b4f5-4c3b-9d5e-cd7b243707c3@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=h.assmann@pengutronix.de \
/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