From: Markus Pargmann <mpa@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH v2 1/4] bbu: Add barebox_update search by device
Date: Wed, 17 Feb 2016 12:28:17 +0100 [thread overview]
Message-ID: <1455708500-980-1-git-send-email-mpa@pengutronix.de> (raw)
bbu_data includes a devicefile information. Add the possibility to make
an update based on the given devicefile. This is in addition to the
normal search for a barebox update handler by its name.
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
common/bbu.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/common/bbu.c b/common/bbu.c
index 4d71fa4a87cb..bf3790d13fff 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -97,6 +97,20 @@ static struct bbu_handler *bbu_find_handler(const char *name)
return NULL;
}
+static struct bbu_handler *bbu_find_handler_by_device(const char *devicepath)
+{
+ struct bbu_handler *handler;
+
+ if (!devicepath)
+ return NULL;
+
+ list_for_each_entry(handler, &bbu_image_handlers, list)
+ if (!strcmp(handler->devicefile, devicepath))
+ return handler;
+
+ return NULL;
+}
+
/*
* do a barebox update with data from *data
*/
@@ -105,7 +119,11 @@ int barebox_update(struct bbu_data *data)
struct bbu_handler *handler;
int ret;
- handler = bbu_find_handler(data->handler_name);
+ handler = bbu_find_handler_by_device(data->devicefile);
+
+ if (!handler)
+ handler = bbu_find_handler(data->handler_name);
+
if (!handler)
return -ENODEV;
--
2.7.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2016-02-17 11:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 11:28 Markus Pargmann [this message]
2016-02-17 11:28 ` [PATCH v2 2/4] bbu: Add function to check if an update handler exists Markus Pargmann
2016-02-17 11:28 ` [PATCH v2 3/4] fastboot: Fix usage of ubiformat for UBI image transfers Markus Pargmann
2016-02-17 11:28 ` [PATCH v2 4/4] fastboot: Add a ARM Barebox filetype handler Markus Pargmann
2016-02-18 8:22 ` Michael Olbrich
2016-02-19 7:44 ` Sascha Hauer
2016-03-11 7:07 ` 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=1455708500-980-1-git-send-email-mpa@pengutronix.de \
--to=mpa@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