summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSteve Rae <srae@broadcom.com>2016-06-07 11:19:37 -0700
committerTom Rini <trini@konsulko.com>2016-06-27 16:37:38 -0400
commit9bc34799c8e6d8907b18e02c405576aa6bf9ce15 (patch)
tree879b7cb9c0aead4b5707a7539d25571060cb80fc /drivers
parentcc0f08cd347ea9741375a70c490c6bee684f7bac (diff)
downloadtalos-obmc-uboot-9bc34799c8e6d8907b18e02c405576aa6bf9ce15.tar.gz
talos-obmc-uboot-9bc34799c8e6d8907b18e02c405576aa6bf9ce15.zip
fastboot: sparse: resync common/image-sparse.c (part 2)
- update fastboot_okay() and fastboot_fail() This file originally came from upstream code. While retaining the storage abstraction feature, this is the second set of the changes required to resync with the cmd_flash_mmc_sparse_img() in the file aboot.c from https://us.codeaurora.org/cgit/quic/la/kernel/lk/plain/app/aboot/aboot.c?h=LE.BR.1.2.1 Signed-off-by: Steve Rae <srae@broadcom.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/f_fastboot.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index ddf989c215..2160b1ccdc 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -151,16 +151,18 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req);
static int strcmp_l1(const char *s1, const char *s2);
-void fastboot_fail(char *response, const char *reason)
+static char *fb_response_str;
+
+void fastboot_fail(const char *reason)
{
- strncpy(response, "FAIL\0", 5);
- strncat(response, reason, FASTBOOT_RESPONSE_LEN - 4 - 1);
+ strncpy(fb_response_str, "FAIL\0", 5);
+ strncat(fb_response_str, reason, FASTBOOT_RESPONSE_LEN - 4 - 1);
}
-void fastboot_okay(char *response, const char *reason)
+void fastboot_okay(const char *reason)
{
- strncpy(response, "OKAY\0", 5);
- strncat(response, reason, FASTBOOT_RESPONSE_LEN - 4 - 1);
+ strncpy(fb_response_str, "OKAY\0", 5);
+ strncat(fb_response_str, reason, FASTBOOT_RESPONSE_LEN - 4 - 1);
}
static void fastboot_complete(struct usb_ep *ep, struct usb_request *req)
@@ -588,15 +590,18 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
return;
}
- strcpy(response, "FAILno flash device defined");
+ /* initialize the response buffer */
+ fb_response_str = response;
+
+ fastboot_fail("no flash device defined");
#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
fb_mmc_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
- download_bytes, response);
+ download_bytes);
#endif
#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
fb_nand_flash_write(cmd,
(void *)CONFIG_FASTBOOT_BUF_ADDR,
- download_bytes, response);
+ download_bytes);
#endif
fastboot_tx_write_str(response);
}
@@ -637,13 +642,15 @@ static void cb_erase(struct usb_ep *ep, struct usb_request *req)
return;
}
- strcpy(response, "FAILno flash device defined");
+ /* initialize the response buffer */
+ fb_response_str = response;
+ fastboot_fail("no flash device defined");
#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
- fb_mmc_erase(cmd, response);
+ fb_mmc_erase(cmd);
#endif
#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
- fb_nand_erase(cmd, response);
+ fb_nand_erase(cmd);
#endif
fastboot_tx_write_str(response);
}
OpenPOWER on IntegriCloud