diff mbox series

[v2,04/12] usb: gadget: aspeed: Improve debugging when nuking

Message ID 20190712025348.21019-5-benh@kernel.crashing.org (mailing list archive)
State Superseded
Headers show
Series usb: gadget: aspeed: Bug fixes | expand

Commit Message

Benjamin Herrenschmidt July 12, 2019, 2:53 a.m. UTC
When nuking requests, it's useful to display how many were
actually nuked. It has proven handy when debugging issues
where EP0 went in a wrong state.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 drivers/usb/gadget/udc/aspeed-vhub/core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Sergei Shtylyov July 12, 2019, 9:01 a.m. UTC | #1
On 12.07.2019 5:53, Benjamin Herrenschmidt wrote:

> When nuking requests, it's useful to display how many were
> actually nuked. It has proven handy when debugging issues
> where EP0 went in a wrong state.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>   drivers/usb/gadget/udc/aspeed-vhub/core.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> index db3628be38c0..0c77cd488c48 100644
> --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
> +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> @@ -65,13 +65,16 @@ void ast_vhub_done(struct ast_vhub_ep *ep, struct ast_vhub_req *req,
>   void ast_vhub_nuke(struct ast_vhub_ep *ep, int status)
>   {
>   	struct ast_vhub_req *req;
> -
> -	EPDBG(ep, "Nuking\n");
> +	int count = 0;
>   
>   	/* Beware, lock will be dropped & req-acquired by done() */
>   	while (!list_empty(&ep->queue)) {
>   		req = list_first_entry(&ep->queue, struct ast_vhub_req, queue);
>   		ast_vhub_done(ep, req, status);
> +		count++;
> +	}
> +	if (count) {
> +		EPDBG(ep, "Nuked %d request(s)\n", count);

    CodingStyle says to avoid {} around a single statement.

>   	}
>   }
>   

MBR, Sergei
Sergei Shtylyov July 12, 2019, 9:06 a.m. UTC | #2
On 12.07.2019 12:01, Sergei Shtylyov wrote:

>> When nuking requests, it's useful to display how many were
>> actually nuked. It has proven handy when debugging issues
>> where EP0 went in a wrong state.
>>
>> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> ---
>>   drivers/usb/gadget/udc/aspeed-vhub/core.c | 7 +++++--
>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c 
>> b/drivers/usb/gadget/udc/aspeed-vhub/core.c
>> index db3628be38c0..0c77cd488c48 100644
>> --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
>> +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
>> @@ -65,13 +65,16 @@ void ast_vhub_done(struct ast_vhub_ep *ep, struct 
>> ast_vhub_req *req,
>>   void ast_vhub_nuke(struct ast_vhub_ep *ep, int status)
>>   {
>>       struct ast_vhub_req *req;
>> -
>> -    EPDBG(ep, "Nuking\n");
>> +    int count = 0;
>>       /* Beware, lock will be dropped & req-acquired by done() */
>>       while (!list_empty(&ep->queue)) {
>>           req = list_first_entry(&ep->queue, struct ast_vhub_req, queue);
>>           ast_vhub_done(ep, req, status);
>> +        count++;
>> +    }
>> +    if (count) {
>> +        EPDBG(ep, "Nuked %d request(s)\n", count);
> 
>     CodingStyle says to avoid {} around a single statement.

    I somehow missed this in v1 posting, sorry about that.

>>       }
>>   }

MBR, Sergei
Benjamin Herrenschmidt July 12, 2019, 11:40 p.m. UTC | #3
On Fri, 2019-07-12 at 12:06 +0300, Sergei Shtylyov wrote:
> On 12.07.2019 12:01, Sergei Shtylyov wrote:
> 
> > > When nuking requests, it's useful to display how many were
> > > actually nuked. It has proven handy when debugging issues
> > > where EP0 went in a wrong state.
> > > 
> > > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > > ---
> > >   drivers/usb/gadget/udc/aspeed-vhub/core.c | 7 +++++--
> > >   1 file changed, 5 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c 
> > > b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > > index db3628be38c0..0c77cd488c48 100644
> > > --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > > +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > > @@ -65,13 +65,16 @@ void ast_vhub_done(struct ast_vhub_ep *ep, struct 
> > > ast_vhub_req *req,
> > >   void ast_vhub_nuke(struct ast_vhub_ep *ep, int status)
> > >   {
> > >       struct ast_vhub_req *req;
> > > -
> > > -    EPDBG(ep, "Nuking\n");
> > > +    int count = 0;
> > >       /* Beware, lock will be dropped & req-acquired by done() */
> > >       while (!list_empty(&ep->queue)) {
> > >           req = list_first_entry(&ep->queue, struct ast_vhub_req, queue);
> > >           ast_vhub_done(ep, req, status);
> > > +        count++;
> > > +    }
> > > +    if (count) {
> > > +        EPDBG(ep, "Nuked %d request(s)\n", count);
> > 
> >     CodingStyle says to avoid {} around a single statement.
> 
>     I somehow missed this in v1 posting, sorry about that.

Yeah well ... there used to be more in there, forgot to remove the {}
when I stripped it down. I'm not going to respin for something so
trivial unless something else shows up.

Felipe, what's your situation with getting those patches ? I haven't
heard for you in a couple of weeks...

Cheers,
Ben.
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c
index db3628be38c0..0c77cd488c48 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
+++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
@@ -65,13 +65,16 @@  void ast_vhub_done(struct ast_vhub_ep *ep, struct ast_vhub_req *req,
 void ast_vhub_nuke(struct ast_vhub_ep *ep, int status)
 {
 	struct ast_vhub_req *req;
-
-	EPDBG(ep, "Nuking\n");
+	int count = 0;
 
 	/* Beware, lock will be dropped & req-acquired by done() */
 	while (!list_empty(&ep->queue)) {
 		req = list_first_entry(&ep->queue, struct ast_vhub_req, queue);
 		ast_vhub_done(ep, req, status);
+		count++;
+	}
+	if (count) {
+		EPDBG(ep, "Nuked %d request(s)\n", count);
 	}
 }