Re: [PATCH 2/2] usb: dwc3: gadget: use num_(in|out)_eps from HW params

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wed, Mar 06, 2013 at 10:00:34PM +0400, Sergei Shtylyov wrote:
> >that way we will only tell gadget framework about
> >the endpoints we actually have.
> 
> >Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> >---
> >  drivers/usb/dwc3/gadget.c | 39 +++++++++++++++++++++++++++++++++++----
> >  1 file changed, 35 insertions(+), 4 deletions(-)
> 
> >diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> >index 8e53acc..aad941f 100644
> >--- a/drivers/usb/dwc3/gadget.c
> >+++ b/drivers/usb/dwc3/gadget.c
> >@@ -1623,14 +1623,15 @@ static const struct usb_gadget_ops dwc3_gadget_ops = {
> >
> >  /* -------------------------------------------------------------------------- */
> >
> >-static int dwc3_gadget_init_endpoints(struct dwc3 *dwc)
> >+static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc,
> >+		u32 num, u32 direction)
> 
>    Why not 'bool direction'?

makes no difference

> >  {
> >  	struct dwc3_ep			*dep;
> >-	u8				epnum;
> >+	u8				i;
> 
>    Why not 'u32 i' if the loop is for 'u32 num'?

because no device will ever have 255 endpoints

> >-	INIT_LIST_HEAD(&dwc->gadget.ep_list);
> >+	for (i = 0; i < num; i++) {
> >+		int		epnum = (i << 1) | (!!direction);
> 
>    () around !!x are superfluous I think.

I rather keep them, it doesn't hurt anyway.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux