mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 4/4] bootchooser: export bootchooser_boot
Date: Thu,  6 Apr 2017 10:49:43 +0200	[thread overview]
Message-ID: <20170406084943.28150-4-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20170406084943.28150-1-s.hauer@pengutronix.de>

Some boards that boot directly from C code do already know that
they want to boot from bootchooser and nothing else. For these
it's easiest to call bootchooser_boot directly, so export this
function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/bootchooser.c  | 19 ++++++++++++-------
 include/bootchooser.h |  2 ++
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/common/bootchooser.c b/common/bootchooser.c
index f2174a1348..455f290fa2 100644
--- a/common/bootchooser.c
+++ b/common/bootchooser.c
@@ -827,15 +827,10 @@ out:
 	return ret;
 }
 
-static int bootchooser_boot(struct bootentry *entry, int verbose, int dryrun)
+int bootchooser_boot(struct bootchooser *bc)
 {
-	struct bootchooser *bc = container_of(entry, struct bootchooser,
-						       entry);
 	int ret, tryagain;
 
-	bc->verbose = verbose;
-	bc->dryrun = dryrun;
-
 	do {
 		ret = bootchooser_boot_one(bc, &tryagain);
 
@@ -846,6 +841,16 @@ static int bootchooser_boot(struct bootentry *entry, int verbose, int dryrun)
 	return ret;
 }
 
+static int bootchooser_entry_boot(struct bootentry *entry, int verbose, int dryrun)
+{
+	struct bootchooser *bc = container_of(entry, struct bootchooser,
+						       entry);
+	bc->verbose = verbose;
+	bc->dryrun = dryrun;
+
+	return bootchooser_boot(bc);
+}
+
 static void bootchooser_release(struct bootentry *entry)
 {
 	struct bootchooser *bc = container_of(entry, struct bootchooser,
@@ -874,7 +879,7 @@ static int bootchooser_add_entry(struct bootentries *entries, const char *name)
 	if (IS_ERR(bc))
 		return PTR_ERR(bc);
 
-	bc->entry.boot = bootchooser_boot;
+	bc->entry.boot = bootchooser_entry_boot;
 	bc->entry.release = bootchooser_release;
 	bc->entry.title = xstrdup("bootchooser");
 	bc->entry.description = xstrdup("bootchooser");
diff --git a/include/bootchooser.h b/include/bootchooser.h
index 246258e8c9..7822c01459 100644
--- a/include/bootchooser.h
+++ b/include/bootchooser.h
@@ -13,6 +13,8 @@ int bootchooser_put(struct bootchooser *bootchooser);
 
 void bootchooser_info(struct bootchooser *bootchooser);
 
+int bootchooser_boot(struct bootchooser *bc);
+
 struct bootchooser_target *bootchooser_get_last_chosen(struct bootchooser *bootchooser);
 const char *bootchooser_target_name(struct bootchooser_target *target);
 struct bootchooser_target *bootchooser_target_by_name(struct bootchooser *bootchooser,
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      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 ` [PATCH 3/4] bootchooser: " Sascha Hauer
2017-04-06  8:49 ` Sascha Hauer [this message]

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