Hi,
> On 07/19/2012 03:22 PM, Gupta, Ajay Kumar wrote:
> 
> >>> There is no need to call read_fifo for zero byte length.
> 
> >>     The same as there's no need to write, and not only here?
> 
> > Yes, it applies to write also but seems write is taken care
> > for zero byte length.
> 
>    Frankly speaking, I don't see it. And what about non-0 endpoints?

We had seen zero byte rx on control endpoints but as it can happen
on non-0 endpoint so it is best to put this check in read_fifo and
write_fifo as you suggested.

I will update the patch and resubmit.

Thanks,
Ajay
> 
> >>> Signed-off-by: Ajay Kumar Gupta <ajay.gu...@ti.com>
> >>> ---
> >>>   drivers/usb/musb/musb_gadget_ep0.c |    6 ++++--
> >>>   1 files changed, 4 insertions(+), 2 deletions(-)
> 
> >>> diff --git a/drivers/usb/musb/musb_gadget_ep0.c
> >> b/drivers/usb/musb/musb_gadget_ep0.c
> >>> index e40d764..d762ddb 100644
> >>> --- a/drivers/usb/musb/musb_gadget_ep0.c
> >>> +++ b/drivers/usb/musb/musb_gadget_ep0.c
> >>> @@ -505,8 +505,10 @@ static void ep0_rxstate(struct musb *musb)
> >>>                           req->status = -EOVERFLOW;
> >>>                           count = len;
> >>>                   }
> >>> -         musb_read_fifo(&musb->endpoints[0], count, buf);
> >>> -         req->actual += count;
> >>> +         if (count) {
> >>> +                 musb_read_fifo(&musb->endpoints[0], count, buf);
> >>> +                 req->actual += count;
> >>> +         }
> 
> >>     Does it save much?
> 
> > We do save some instruction and that's good to have.
> 
>    Wouldn't it be better to check for zero count inside
> musb_{read|write}_fifo()
> though?
> 
> WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to