From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 3/4] bootchooser: register as bootentry provider
Date: Thu, 6 Apr 2017 10:49:42 +0200 [thread overview]
Message-ID: <20170406084943.28150-3-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20170406084943.28150-1-s.hauer@pengutronix.de>
Instead of using a global function called by
bootentry_create_from_name(), register the bootchooser as bootentry
provider.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/boot.c | 6 ------
common/bootchooser.c | 11 +++++++++--
include/bootchooser.h | 2 --
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/common/boot.c b/common/boot.c
index 3280ac4f54..cef3d5e514 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -289,12 +289,6 @@ int bootentry_create_from_name(struct bootentries *bootentries,
found += ret;
}
- if (IS_ENABLED(CONFIG_BOOTCHOOSER) && !strcmp(name, "bootchooser")) {
- ret = bootchooser_create_bootentry(bootentries);
- if (ret > 0)
- found += ret;
- }
-
if (!found) {
char *path;
diff --git a/common/bootchooser.c b/common/bootchooser.c
index 9c110f267e..f2174a1348 100644
--- a/common/bootchooser.c
+++ b/common/bootchooser.c
@@ -863,10 +863,14 @@ static void bootchooser_release(struct bootentry *entry)
*
* Return: The number of entries added to the list
*/
-int bootchooser_create_bootentry(struct bootentries *entries)
+static int bootchooser_add_entry(struct bootentries *entries, const char *name)
{
- struct bootchooser *bc = bootchooser_get();
+ struct bootchooser *bc;
+
+ if (strcmp(name, "bootchooser"))
+ return 0;
+ bc = bootchooser_get();
if (IS_ERR(bc))
return PTR_ERR(bc);
@@ -904,6 +908,9 @@ static int bootchooser_init(void)
reset_attempts_names, ARRAY_SIZE(reset_attempts_names));
globalvar_add_simple_bitmask("bootchooser.reset_priorities", &reset_priorities,
reset_priorities_names, ARRAY_SIZE(reset_priorities_names));
+
+ bootentry_register_provider(bootchooser_add_entry);
+
return 0;
}
device_initcall(bootchooser_init);
diff --git a/include/bootchooser.h b/include/bootchooser.h
index c948247722..246258e8c9 100644
--- a/include/bootchooser.h
+++ b/include/bootchooser.h
@@ -19,8 +19,6 @@ struct bootchooser_target *bootchooser_target_by_name(struct bootchooser *bootch
const char *name);
void bootchooser_target_force_boot(struct bootchooser_target *target);
-int bootchooser_create_bootentry(struct bootentries *entries);
-
int bootchooser_target_set_attempts(struct bootchooser_target *target, int attempts);
int bootchooser_target_set_priority(struct bootchooser_target *target, int priority);
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2017-04-06 8:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-06 8:49 [PATCH 1/4] boot: Allow to register boot entry providers Sascha Hauer
2017-04-06 8:49 ` [PATCH 2/4] blspec: register as bootentry provider Sascha Hauer
2017-04-06 8:49 ` Sascha Hauer [this message]
2017-04-06 8:49 ` [PATCH 4/4] bootchooser: export bootchooser_boot Sascha Hauer
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=20170406084943.28150-3-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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