summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
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 /drivers/usb/gadget
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 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/f_fastboot.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 0f25c13998..58d9230b07 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -986,12 +986,14 @@ static void cb_flash(struct f_fastboot *f_fb, const char *cmd)
}
if (IS_ENABLED(CONFIG_BAREBOX_UPDATE) && filetype_is_barebox_image(filetype)) {
+ struct bbu_handler *handler;
struct bbu_data data = {
.devicefile = filename,
.flags = BBU_FLAG_YES,
};
- if (!bbu_find_handler_by_device(data.devicefile))
+ handler = bbu_find_handler_by_device(data.devicefile);
+ if (!handler)
goto copy;
fastboot_tx_print(f_fb, "INFOThis is a barebox image...");
@@ -1010,7 +1012,7 @@ static void cb_flash(struct f_fastboot *f_fb, const char *cmd)
data.image = f_fb->buf;
data.imagefile = sourcefile;
- ret = barebox_update(&data);
+ ret = barebox_update(&data, handler);
if (ret)
fastboot_tx_print(f_fb, "FAILupdate barebox: %s", strerror(-ret));