Re: [PATCH 07/15] USB: mv_udc: add spin_lock in mv_ep_enable

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

 



* Neil Zhang | 2011-09-19 16:21:29 [+0800]:

>1: add spinlock to prevent race.
>2: set unused endpoint type to bulk.

>From the description point of view: try to describe why are doing things
that you are doing. Most people here can read and understand C. Those
who can't, well they can learn :)
So try to describe which race may occor or how it can occur. Describe
the scenario a little. I don't expect a Novel here but something.
For instance I see that you change the type explicit to bulk since
I can read C and understand the patch format :). I also know that
"desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK" holds the type of the
endpoint. So my question is why do you set this here explicit bulk even
that the requests type may be different. The answer is that the unused
endpoints have to be set to bulk. This is what I would expect in the
patch description.

>Change-Id: If3d4ac38ce06d0ea61c772104902b1ce4fb0330b
>Signed-off-by: Neil Zhang <zhangwm@xxxxxxxxxxx>
>---
> drivers/usb/gadget/mv_udc_core.c |   14 +++++++++-----
> 1 files changed, 9 insertions(+), 5 deletions(-)
>
>diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c
>index c06385d..6891b0b 100644
>--- a/drivers/usb/gadget/mv_udc_core.c
>+++ b/drivers/usb/gadget/mv_udc_core.c
>@@ -556,6 +554,10 @@ static int mv_ep_enable(struct usb_ep *_ep,
> 	default:
> 		goto en_done;
> 	}
>+
>+	spin_lock_irqsave(&udc->lock, flags);
>+	/* Get the endpoint queue head address */
>+	dqh = (struct mv_dqh *)ep->dqh;

No type casts.

> 	dqh->max_packet_length = (max << EP_QUEUE_HEAD_MAX_PKT_LEN_POS)
> 		| (mult << EP_QUEUE_HEAD_MULT_POS)
> 		| (zlt ? EP_QUEUE_HEAD_ZLT_SEL : 0)

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


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

  Powered by Linux