[U-Boot] [RFC PATCH v2 04/20] fastboot: Extract fastboot_okay/fail to fb_common.c
Alex Kiernan
alex.kiernan at gmail.com
Mon Apr 30 08:32:38 UTC 2018
Add drivers/fastboot/fb_common.c, where fastboot_okay/fail are implemented
so we can call them from a non-USB implementation.
Signed-off-by: Alex Kiernan <alex.kiernan at gmail.com>
---
Changes in v2: None
drivers/fastboot/Makefile | 1 +
drivers/fastboot/fb_common.c | 26 ++++++++++++++++++++++++++
drivers/usb/gadget/f_fastboot.c | 13 -------------
3 files changed, 27 insertions(+), 13 deletions(-)
create mode 100644 drivers/fastboot/fb_common.c
diff --git a/drivers/fastboot/Makefile b/drivers/fastboot/Makefile
index 63a67c1..5b8337f 100644
--- a/drivers/fastboot/Makefile
+++ b/drivers/fastboot/Makefile
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0+
+obj-y += fb_common.o
obj-$(CONFIG_FASTBOOT_FLASH) += image-sparse.o
ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c
new file mode 100644
index 0000000..53cffe3
--- /dev/null
+++ b/drivers/fastboot/fb_common.c
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2008 - 2009
+ * Windriver, <www.windriver.com>
+ * Tom Rix <Tom.Rix at windriver.com>
+ *
+ * Copyright 2011 Sebastian Andrzej Siewior <bigeasy at linutronix.de>
+ *
+ * Copyright 2014 Linaro, Ltd.
+ * Rob Herring <robh at kernel.org>
+ */
+
+#include <common.h>
+#include <fastboot.h>
+
+void fastboot_fail(const char *reason, char *response)
+{
+ strncpy(response, "FAIL\0", 5);
+ strncat(response, reason, FASTBOOT_RESPONSE_LEN - 4 - 1);
+}
+
+void fastboot_okay(const char *reason, char *response)
+{
+ strncpy(response, "OKAY\0", 5);
+ strncat(response, reason, FASTBOOT_RESPONSE_LEN - 4 - 1);
+}
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 6ae1d97..fda4505 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -150,19 +150,6 @@ static struct usb_gadget_strings *fastboot_strings[] = {
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(const char *reason, char *response)
-{
- strncpy(response, "FAIL\0", 5);
- strncat(response, reason, FASTBOOT_RESPONSE_LEN - 4 - 1);
-}
-
-void fastboot_okay(const char *reason, char *response)
-{
- strncpy(response, "OKAY\0", 5);
- strncat(response, reason, FASTBOOT_RESPONSE_LEN - 4 - 1);
-}
-
static void fastboot_complete(struct usb_ep *ep, struct usb_request *req)
{
int status = req->status;
--
2.7.4
More information about the U-Boot
mailing list