summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2018-10-07 23:35:16 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2018-10-08 10:07:12 +0200
commitc4ed3b223126e69d697fbf482ab60e125bbe3d43 (patch)
treea4147091bdb2051dbb331aaedb987106cf978079 /common
parent76b44a34fc00772319395a84e67b8f816804f5bc (diff)
downloadbarebox-c4ed3b223126e69d697fbf482ab60e125bbe3d43.tar.gz
barebox-c4ed3b223126e69d697fbf482ab60e125bbe3d43.tar.xz
bbu: Add "handler" parameter to barebox_update()
Add "handler" parameter to barebox_update() and remove the code that was respondible for header lookup before. With this change finding appropriate handler is caller's responsibility, which makes it possible to implement custom handler lookup/existence check, chache it, and then re-use it without calling handler_find_by_* functions for the second time. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/bbu.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/common/bbu.c b/common/bbu.c
index fabd949664..75c3221d56 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -216,19 +216,10 @@ static int bbu_check_metadata(struct bbu_data *data)
/*
* do a barebox update with data from *data
*/
-int barebox_update(struct bbu_data *data)
+int barebox_update(struct bbu_data *data, struct bbu_handler *handler)
{
- struct bbu_handler *handler;
int ret;
- handler = bbu_find_handler_by_device(data->devicefile);
-
- if (!handler)
- handler = bbu_find_handler_by_name(data->handler_name);
-
- if (!handler)
- return -ENODEV;
-
if (!data->image && !data->imagefile &&
!(handler->flags & BBU_HANDLER_CAN_REFRESH)) {
pr_err("No Image file given\n");