mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] barebox update: fix finding default handler
@ 2012-11-29 19:01 Sascha Hauer
  2012-11-29 19:01 ` [PATCH 2/4] ARM i.MX bbu: Add i.MX6 MMC handler Sascha Hauer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-11-29 19:01 UTC (permalink / raw)
  To: barebox

It was not possible to register another handler when already
a default handler is registered. Fix this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/bbu.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/common/bbu.c b/common/bbu.c
index 92f8d2b..e31f645 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -71,13 +71,13 @@ int bbu_confirm(struct bbu_data *data)
 	return -EINTR;
 }
 
-static struct bbu_handler *bbu_find_handler(const char *name, unsigned long flags)
+static struct bbu_handler *bbu_find_handler(const char *name)
 {
 	struct bbu_handler *handler;
 
 	list_for_each_entry(handler, &bbu_image_handlers, list) {
 		if (!name) {
-			if (flags & BBU_HANDLER_FLAG_DEFAULT)
+			if (handler->flags & BBU_HANDLER_FLAG_DEFAULT)
 				return handler;
 			continue;
 		}
@@ -97,10 +97,13 @@ int barebox_update(struct bbu_data *data)
 	struct bbu_handler *handler;
 	int ret;
 
-	handler = bbu_find_handler(data->handler_name, data->flags);
+	handler = bbu_find_handler(data->handler_name);
 	if (!handler)
 		return -ENODEV;
 
+	if (!data->handler_name)
+		data->handler_name = handler->name;
+
 	if (!data->devicefile)
 		data->devicefile = handler->devicefile;
 
@@ -137,11 +140,11 @@ void bbu_handlers_list(void)
  */
 int bbu_register_handler(struct bbu_handler *handler)
 {
-	if (bbu_find_handler(handler->name, 0))
+	if (bbu_find_handler(handler->name))
 		return -EBUSY;
 
 	if (handler->flags & BBU_HANDLER_FLAG_DEFAULT &&
-			bbu_find_handler(NULL, BBU_HANDLER_FLAG_DEFAULT))
+			bbu_find_handler(NULL))
 		return -EBUSY;
 
 	list_add_tail(&handler->list, &bbu_image_handlers);
-- 
1.7.10.4


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-11-29 19:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-29 19:01 [PATCH 1/4] barebox update: fix finding default handler Sascha Hauer
2012-11-29 19:01 ` [PATCH 2/4] ARM i.MX bbu: Add i.MX6 MMC handler Sascha Hauer
2012-11-29 19:01 ` [PATCH 3/4] ARM i.MX bbu internal: Add spi/i2c support Sascha Hauer
2012-11-29 19:01 ` [PATCH 4/4] ARM i.MX6: save boot location Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox