summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-07-20 07:50:40 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-08-09 09:38:36 +0200
commit2fc6302090cd77c368cf784adf91dc2beb71764c (patch)
tree3f17cfe618da72406f1935a2b97aa6f73baa1bc7 /common
parentef65ce9ba18d53f3aa046fef01ed63672bccf6b8 (diff)
downloadbarebox-2fc6302090cd77c368cf784adf91dc2beb71764c.tar.gz
barebox-2fc6302090cd77c368cf784adf91dc2beb71764c.tar.xz
bootsource: rename existing bootsource_set to bootsource_set_raw
Patterns like [ "$bootsource" = mmc ] && boot mmc$bootsource_instance expect that ${bootsource_instance} and MMC aliases align, which may not always be the case. In preparation for adding a new bootsource_set function that consults an optional mapping table from bootrom bootsource_instance to board-specific device numbering, rename all existing instances to bootsource_set_raw. While at it, clean up the legacy split into bootsource_set and bootsource_set_instance and have the new bootsource_set_raw accept both arguments at once. No functional change intended. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220720055042.3510276-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/bootsource.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/common/bootsource.c b/common/bootsource.c
index 79dacfd1d0..c37da38f7f 100644
--- a/common/bootsource.c
+++ b/common/bootsource.c
@@ -101,7 +101,7 @@ void bootsource_set_alias_name(const char *name)
bootsource_alias_name = name;
}
-void bootsource_set(enum bootsource src)
+void bootsource_set_raw(enum bootsource src, int instance)
{
if (src >= ARRAY_SIZE(bootsource_str))
src = BOOTSOURCE_UNKNOWN;
@@ -109,9 +109,11 @@ void bootsource_set(enum bootsource src)
bootsource = src;
setenv("bootsource", bootsource_str[src]);
+
+ bootsource_set_raw_instance(instance);
}
-void bootsource_set_instance(int instance)
+void bootsource_set_raw_instance(int instance)
{
bootsource_instance = instance;
@@ -137,8 +139,7 @@ BAREBOX_MAGICVAR(bootsource_instance, "The instance of the source barebox has be
static int bootsource_init(void)
{
- bootsource_set(bootsource);
- bootsource_set_instance(bootsource_instance);
+ bootsource_set_raw(bootsource, bootsource_instance);
export("bootsource");
export("bootsource_instance");