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 2/4] blspec: register as bootentry provider
Date: Thu,  6 Apr 2017 10:49:41 +0200	[thread overview]
Message-ID: <20170406084943.28150-2-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 blspec as bootentry
provider.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/blspec.c | 24 ++++++++++++++++++++++++
 common/boot.c   | 12 ------------
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/common/blspec.c b/common/blspec.c
index ec63ddb407..8132d141ab 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -732,3 +732,27 @@ int blspec_scan_devicename(struct bootentries *bootentries, const char *devname)
 
 	return blspec_scan_device(bootentries, dev);
 }
+
+static int blspec_bootentry_provider(struct bootentries *bootentries,
+				     const char *name)
+{
+	int ret, found = 0;
+
+	ret = blspec_scan_devicename(bootentries, name);
+	if (ret > 0)
+		found += ret;
+
+	if (*name == '/' || !strncmp(name, "nfs://", 6)) {
+		ret = blspec_scan_directory(bootentries, name);
+		if (ret > 0)
+			found += ret;
+	}
+
+	return found;
+}
+
+static int blspec_init(void)
+{
+	return bootentry_register_provider(blspec_bootentry_provider);
+}
+device_initcall(blspec_init);
\ No newline at end of file
diff --git a/common/boot.c b/common/boot.c
index f0359cff38..3280ac4f54 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -283,18 +283,6 @@ int bootentry_create_from_name(struct bootentries *bootentries,
 	struct bootentry_provider *p;
 	int found = 0, ret;
 
-	if (IS_ENABLED(CONFIG_BLSPEC)) {
-		ret = blspec_scan_devicename(bootentries, name);
-		if (ret > 0)
-			found += ret;
-
-		if (*name == '/' || !strncmp(name, "nfs://", 6)) {
-			ret = blspec_scan_directory(bootentries, name);
-			if (ret > 0)
-				found += ret;
-		}
-	}
-
 	list_for_each_entry(p, &bootentry_providers, list) {
 		ret = p->fn(bootentries, name);
 		if (ret > 0)
-- 
2.11.0


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

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