From: Markus Pargmann <mpa@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/4] bbu: Add function to check if an update handler exists
Date: Tue, 16 Feb 2016 19:54:46 +0100 [thread overview]
Message-ID: <1455648888-20678-2-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1455648888-20678-1-git-send-email-mpa@pengutronix.de>
This adds a function to check for the existence of an update handler
based on the supplied bbu_data.
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
common/bbu.c | 14 ++++++++++++++
include/bbu.h | 2 ++
2 files changed, 16 insertions(+)
diff --git a/common/bbu.c b/common/bbu.c
index bf3790d13fff..a7f6b4b851ee 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -111,6 +111,20 @@ static struct bbu_handler *bbu_find_handler_by_device(const char *devicepath)
return NULL;
}
+bool barebox_update_handler_exists(struct bbu_data *data)
+{
+ struct bbu_handler *handler;
+
+ handler = bbu_find_handler_by_device(data->devicefile);
+ if (handler)
+ return true;
+
+ if (!data->handler_name)
+ return false;
+
+ return !bbu_find_handler(data->handler_name);
+}
+
/*
* do a barebox update with data from *data
*/
diff --git a/include/bbu.h b/include/bbu.h
index 727791171858..0fe7a1a9bcdb 100644
--- a/include/bbu.h
+++ b/include/bbu.h
@@ -36,6 +36,8 @@ int bbu_confirm(struct bbu_data *);
int barebox_update(struct bbu_data *);
+bool barebox_update_handler_exists(struct bbu_data *);
+
void bbu_handlers_list(void);
#ifdef CONFIG_BAREBOX_UPDATE
--
2.7.0.rc3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2016-02-16 18:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 18:54 [PATCH 1/4] bbu: Add barebox_update search by device Markus Pargmann
2016-02-16 18:54 ` Markus Pargmann [this message]
2016-02-16 18:54 ` [PATCH 3/4] fastboot: Fix usage of ubiformat for UBI image transfers Markus Pargmann
2016-02-17 7:29 ` Sascha Hauer
2016-02-17 9:33 ` Markus Pargmann
2016-02-16 18:54 ` [PATCH 4/4] fastboot: Add a ARM Barebox filetype handler Markus Pargmann
2016-02-17 7:37 ` Sascha Hauer
2016-02-17 10:02 ` Markus Pargmann
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=1455648888-20678-2-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