From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org, h.assmann@pengutronix.de
Subject: Re: [PATCH v2 2/4] environment: implement of_env_get_alias_by_path helper
Date: Mon, 2 Dec 2024 10:49:47 +0100 [thread overview]
Message-ID: <Z02Cu7KiqjqNiTgp@pengutronix.de> (raw)
In-Reply-To: <970fb560-b4f5-4c3b-9d5e-cd7b243707c3@pengutronix.de>
On Fri, Nov 15, 2024 at 01:38:03PM +0100, Ahmad Fatoum wrote:
> 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.
LGTM otherwise.
Sascha
>
> 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 |
>
>
--
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-12-02 9:50 UTC|newest]
Thread overview: 6+ 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
2024-12-02 9:49 ` Sascha Hauer [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=Z02Cu7KiqjqNiTgp@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=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