summaryrefslogtreecommitdiffstats
path: root/common/bbu.c
diff options
context:
space:
mode:
authorMarkus Pargmann <mpa@pengutronix.de>2016-02-17 12:28:17 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-02-18 16:10:11 +0100
commit473da9de5b9b5e0266767c1bdf5fc8882fb43a16 (patch)
treeecd4cea049f30a2825d45f98137762b259070591 /common/bbu.c
parentf1f8f5556ab94f4f8bedb97ad0199b2e63958c8b (diff)
downloadbarebox-473da9de5b9b5e0266767c1bdf5fc8882fb43a16.tar.gz
barebox-473da9de5b9b5e0266767c1bdf5fc8882fb43a16.tar.xz
bbu: Add barebox_update search by device
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/bbu.c')
-rw-r--r--common/bbu.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/common/bbu.c b/common/bbu.c
index 4d71fa4a87..bf3790d13f 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;