summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-04-26 00:21:35 (GMT)
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-30 00:24:31 (GMT)
commit409ba9e7c023bdbfd2ecab960532523124de5c81 (patch)
tree08d53974e920ba7b49301286bf4b6eccfac2be30 /drivers/usb
parent45e13e6e0aa954af2d4779a07262f4c12d6f032f (diff)
downloadlinux-409ba9e7c023bdbfd2ecab960532523124de5c81.tar.xz
usb: renesas_usbhs: don't re-allocation pipe buffer
Because pipe buffer allocation is very picky and difficult, current renesas_usbhs driver is not caring pipe re-allocation. In this situation, driver will create new pipe without caring old pipe if "usbhsg_ep_enable" is called after "usbhsg_ep_disable" on current driver. This mean the limited pipe and buffer will be used as waste. But it is possible to re-use same buffer to same pipe. By this patch, driver will initialize pipe when it detected new connection or new gadget, and doesn't try re-allocation for same pipe in above case. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/renesas_usbhs/mod_gadget.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index 9a5ac02..8c721d8 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -787,12 +787,18 @@ static int usbhsg_pipe_disable(struct usbhsg_uep *uep)
usbhsg_queue_pop(uep, ureq, -ECONNRESET);
}
- uep->pipe->mod_private = NULL;
- uep->pipe = NULL;
-
return 0;
}
+static void usbhsg_uep_init(struct usbhsg_gpriv *gpriv)
+{
+ int i;
+ struct usbhsg_uep *uep;
+
+ usbhsg_for_each_uep_with_dcp(uep, gpriv, i)
+ uep->pipe = NULL;
+}
+
/*
*
* usb_ep_ops
@@ -809,6 +815,13 @@ static int usbhsg_ep_enable(struct usb_ep *ep,
unsigned long flags;
int ret = -EIO;
+ /*
+ * if it already have pipe,
+ * nothing to do
+ */
+ if (uep->pipe)
+ return 0;
+
/******************** spin lock ********************/
spin_lock_irqsave(lock, flags);
@@ -1045,6 +1058,7 @@ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status)
* pipe initialize and enable DCP
*/
usbhs_pipe_init(priv);
+ usbhsg_uep_init(gpriv);
usbhsg_dcp_enable(dcp);
/*