[RFC PATCH] bootsource: add helper to set instance by name

Sascha Hauer sha at pengutronix.de
Fri Jan 14 01:15:00 PST 2022


On Wed, Nov 17, 2021 at 03:24:48PM +0100, Michael Riesch wrote:
> Instance numbers should be related to device tree aliases, which may be
> board-specific.

When instance numbers were introduced they were meant to be SoC
specific, i.e. they should correspond to the numbers in the manual.
When starting with device tree aliases the alias numbers were assumed to
match the numbers in the manual. On i.MX this is still mostly true, but
on (most?) other SoCs it is not. In barebox we have several users of
bootsource_get_instance() which rely on the instance being the hardware
instance number, so we can't just change that.

If we have to keep track of both hardware numbers and alias numbers we
have to store both separately and not change the meaning of the existing
instance number.

Thinking this further I don't think the alias is worth anything because
it may differ between the barebox internal device tree and the one the
kernel is booted with. We should rather store the device node providing
the bootsource. From that we can retrieve the alias matching a given
device tree if we still need it.

That said, I don't know a good way how we get there from our existing
codebase.

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