[PATCH 2/3] bootsource: add function to get device_node we booted from

Sascha Hauer s.hauer at pengutronix.de
Tue Feb 20 02:56:46 PST 2024


On Mon, Feb 19, 2024 at 04:21:07PM +0100, Sascha Hauer wrote:
> On Mon, Feb 19, 2024 at 03:59:36PM +0100, Marco Felsch wrote:
> > On 24-02-19, Sascha Hauer wrote:
> > > We have a relation between the bootsource and the corresponding
> > > device_node. Add a function to get the device_node we booted from.
> > > This is already open coded in of_fixup_bootargs_bootsource(),
> > > use the newly created function for it.
> > > 
> > > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> > > ---
> > >  common/bootsource.c  | 14 ++++++++++++++
> > >  common/oftree.c      |  7 +------
> > >  include/bootsource.h |  1 +
> > >  3 files changed, 16 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/common/bootsource.c b/common/bootsource.c
> > > index da528a5b9b..5666d8d30d 100644
> > > --- a/common/bootsource.c
> > > +++ b/common/bootsource.c
> > > @@ -108,6 +108,20 @@ char *bootsource_get_alias_name(void)
> > >  	return basprintf("%s%d", stem, bootsource_instance);
> > >  }
> > >  
> > > +struct device_node *bootsource_of_node_get(struct device_node *root)
> > > +{
> > > +	struct device_node *np;
> > > +	char *alias_name;
> > > +
> > > +	alias_name = bootsource_get_alias_name();
> > 
> > 	if (!alias_name) {
> > 		pr_warn("No alias found for bootsource\n");
> > 		return 0;
> > 	}
> 
> I'll have to look over this. With this we assume that for example the
> mmcx alias really matches bootsource instance x. This is not the case,
> instead we have to look for an alias named "barebox,bootsource-%s%u".

Looking at this again I believe it is correctly handled in the patch.
I was under the assumption that the "barebox,bootsource-%s%u" property
was not honoured, but in fact it is.

Still I believe a warning is not appropriate here as it would warn about
too many false positives.

Sascha

-- 
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 |



More information about the barebox mailing list