Patchwork [U-Boot,v3,4/4] usb/gadget: fastboot: minor cleanup

login
register
mail settings
Submitter Steve Rae
Date June 26, 2014, 8:13 p.m.
Message ID <1403813604-31685-5-git-send-email-srae@broadcom.com>
Download mbox | patch
Permalink /patch/364708/
State Superseded
Delegated to: Marek Vasut
Headers show

Comments

Steve Rae - June 26, 2014, 8:13 p.m.
- update static function
- additional debugging statements

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

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

 drivers/usb/gadget/f_fastboot.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Marek Vasut - July 31, 2014, 1:40 a.m.
On Thursday, June 26, 2014 at 10:13:24 PM, Steve Rae wrote:
> - update static function
> - additional debugging statements
> 
> Signed-off-by: Steve Rae <srae@broadcom.com>
> ---
> 
> Changes in v3: None
> Changes in v2:
> - new in v2
> 
>  drivers/usb/gadget/f_fastboot.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c index 89c2d3e..3e6e47f 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -293,7 +293,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;
> @@ -338,6 +338,7 @@ static void cb_getvar(struct usb_ep *ep, struct
> usb_request *req) strcpy(response, "OKAY");
>  	strsep(&cmd, ":");
>  	if (!cmd) {
> +		printf("%s: missing var\n", __func__);

I'd spell it out completely -- variable -- but I'm not sure if you might need to 
maintain some kind of compatibility with the fastboot responses here or not.
[...]

Best regards,
Marek Vasut
Steve Rae - Aug. 6, 2014, 11:34 p.m.
On 14-07-30 06:40 PM, Marek Vasut wrote:
> On Thursday, June 26, 2014 at 10:13:24 PM, Steve Rae wrote:
>> - update static function
>> - additional debugging statements
>>
>> Signed-off-by: Steve Rae <srae@broadcom.com>
>> ---
>>
>> Changes in v3: None
>> Changes in v2:
>> - new in v2
>>
>>   drivers/usb/gadget/f_fastboot.c | 10 +++++++---
>>   1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/f_fastboot.c
>> b/drivers/usb/gadget/f_fastboot.c index 89c2d3e..3e6e47f 100644
>> --- a/drivers/usb/gadget/f_fastboot.c
>> +++ b/drivers/usb/gadget/f_fastboot.c
>> @@ -293,7 +293,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;
>> @@ -338,6 +338,7 @@ static void cb_getvar(struct usb_ep *ep, struct
>> usb_request *req) strcpy(response, "OKAY");
>>   	strsep(&cmd, ":");
>>   	if (!cmd) {
>> +		printf("%s: missing var\n", __func__);
>
> I'd spell it out completely -- variable -- but I'm not sure if you might need to
> maintain some kind of compatibility with the fastboot responses here or not.

nope -- done in v4
Thanks, Steve

> [...]
>
> Best regards,
> Marek Vasut
>

Patch

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 89c2d3e..3e6e47f 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -293,7 +293,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;
@@ -338,6 +338,7 @@  static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
 	strcpy(response, "OKAY");
 	strsep(&cmd, ":");
 	if (!cmd) {
+		printf("%s: missing var\n", __func__);
 		fastboot_tx_write_str("FAILmissing var");
 		return;
 	}
@@ -358,6 +359,7 @@  static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
 		else
 			strcpy(response, "FAILValue not set");
 	} else {
+		printf("%s: unknown variable: %s\n", __func__, cmd);
 		strcpy(response, "FAILVariable not implemented");
 	}
 	fastboot_tx_write_str(response);
@@ -531,10 +533,12 @@  static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
 		}
 	}
 
-	if (!func_cb)
+	if (!func_cb) {
+		printf("%s: unknown command: %s\n", __func__, cmdbuf);
 		fastboot_tx_write_str("FAILunknown command");
-	else
+	} else {
 		func_cb(ep, req);
+	}
 
 	if (req->status == 0) {
 		*cmdbuf = '\0';