[v6,3/4] usb/gadget: fastboot: minor cleanup

Message ID 1409078850-7873-4-git-send-email-srae@broadcom.com
State Accepted
Commit 593cbd93f33c38ca3ee9db34b5657a15d2437902
Headers show

Commit Message

Steve Rae Aug. 26, 2014, 6:47 p.m.
- update static function
- additional debugging statements
- update "fastboot command" information
- add missing include file
- update spelling

Signed-off-by: Steve Rae <srae@broadcom.com>
---

Changes in v6:
- printf() to error()

Changes in v5: None
Changes in v4:
- update debug string as per feedback

Changes in v3: None
Changes in v2:
- new in v2

 common/cmd_fastboot.c           |  7 ++++---
 drivers/usb/gadget/f_fastboot.c | 15 ++++++++++-----
 2 files changed, 14 insertions(+), 8 deletions(-)

Comments

Tom Rini Sept. 25, 2014, 2:44 p.m. | #1
On Tue, Aug 26, 2014 at 11:47:29AM -0700, Steve Rae wrote:

> - update static function
> - additional debugging statements
> - update "fastboot command" information
> - add missing include file
> - update spelling
> 
> Signed-off-by: Steve Rae <srae@broadcom.com>

Applied to u-boot/master, thanks!

Patch

diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c
index 83fa7bd..909616d 100644
--- a/common/cmd_fastboot.c
+++ b/common/cmd_fastboot.c
@@ -30,7 +30,8 @@  static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 }
 
 U_BOOT_CMD(
-	fastboot,	1,	1,	do_fastboot,
-	"fastboot - enter USB Fastboot protocol",
-	""
+	fastboot,	1,	0,	do_fastboot,
+	"use USB Fastboot protocol",
+	"\n"
+	"    - run as a fastboot usb device"
 );
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index e2659fa..38c0965 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -10,6 +10,7 @@ 
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
+#include <config.h>
 #include <common.h>
 #include <errno.h>
 #include <malloc.h>
@@ -41,7 +42,7 @@ 
 struct f_fastboot {
 	struct usb_function usb_function;
 
-	/* IN/OUT EP's and correspoinding requests */
+	/* IN/OUT EP's and corresponding requests */
 	struct usb_ep *in_ep, *out_ep;
 	struct usb_request *in_req, *out_req;
 };
@@ -293,7 +294,7 @@  static int fastboot_add(struct usb_configuration *c)
 }
 DECLARE_GADGET_BIND_CALLBACK(usb_dnl_fastboot, fastboot_add);
 
-int fastboot_tx_write(const char *buffer, unsigned int buffer_size)
+static int fastboot_tx_write(const char *buffer, unsigned int buffer_size)
 {
 	struct usb_request *in_req = fastboot_func->in_req;
 	int ret;
@@ -341,6 +342,7 @@  static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
 
 	strsep(&cmd, ":");
 	if (!cmd) {
+		error("missing variable\n");
 		fastboot_tx_write_str("FAILmissing var");
 		return;
 	}
@@ -361,6 +363,7 @@  static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
 		else
 			strcpy(response, "FAILValue not set");
 	} else {
+		error("unknown variable: %s\n", cmd);
 		strcpy(response, "FAILVariable not implemented");
 	}
 	fastboot_tx_write_str(response);
@@ -480,7 +483,7 @@  static void cb_flash(struct usb_ep *ep, struct usb_request *req)
 
 	strsep(&cmd, ":");
 	if (!cmd) {
-		printf("%s: missing partition name\n", __func__);
+		error("missing partition name\n");
 		fastboot_tx_write_str("FAILmissing partition name");
 		return;
 	}
@@ -534,10 +537,12 @@  static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
 		}
 	}
 
-	if (!func_cb)
+	if (!func_cb) {
+		error("unknown command: %s\n", cmdbuf);
 		fastboot_tx_write_str("FAILunknown command");
-	else
+	} else {
 		func_cb(ep, req);
+	}
 
 	if (req->status == 0) {
 		*cmdbuf = '\0';