Patchwork [U-Boot,V4,12/17] usb: gadget: mv_udc: optimize ep_enable

login
register
mail settings
Submitter Troy Kisky
Date Sept. 20, 2013, 3:29 a.m.
Message ID <1379647780-2623-13-git-send-email-troy.kisky@boundarydevices.com>
Download mbox | patch
Permalink /patch/276194/
State Superseded
Delegated to: Marek Vasut
Headers show

Comments

Troy Kisky - Sept. 20, 2013, 3:29 a.m.
Only get head if not ep0.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

---
v4: no change
---
 drivers/usb/gadget/mv_udc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/drivers/usb/gadget/mv_udc.c b/drivers/usb/gadget/mv_udc.c
index 075b039..995585d 100644
--- a/drivers/usb/gadget/mv_udc.c
+++ b/drivers/usb/gadget/mv_udc.c
@@ -216,10 +216,8 @@  static void mv_ep_free_request(struct usb_ep *ep, struct usb_request *_req)
 
 static void ep_enable(int num, int in, int maxpacket)
 {
-	struct ept_queue_head *head;
 	struct mv_udc *udc = (struct mv_udc *)controller.ctrl->hcor;
 	unsigned n;
-	head = mv_get_qh(num, in);
 
 	n = readl(&udc->epctrl[num]);
 	if (in)
@@ -228,6 +226,8 @@  static void ep_enable(int num, int in, int maxpacket)
 		n |= (CTRL_RXE | CTRL_RXR | CTRL_RXT_BULK);
 
 	if (num != 0) {
+		struct ept_queue_head *head = mv_get_qh(num, in);
+
 		head->config = CONFIG_MAX_PKT(maxpacket) | CONFIG_ZLT;
 		mv_flush_qh(num);
 	}