aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-04-25 20:21:35 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-29 20:24:31 -0400
commit409ba9e7c023bdbfd2ecab960532523124de5c81 (patch)
tree08d53974e920ba7b49301286bf4b6eccfac2be30 /drivers/usb/renesas_usbhs
parent45e13e6e0aa954af2d4779a07262f4c12d6f032f (diff)
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/renesas_usbhs')
-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 9a5ac02077b..8c721d86bac 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)
787 usbhsg_queue_pop(uep, ureq, -ECONNRESET); 787 usbhsg_queue_pop(uep, ureq, -ECONNRESET);
788 } 788 }
789 789
790 uep->pipe->mod_private = NULL;
791 uep->pipe = NULL;
792
793 return 0; 790 return 0;
794} 791}
795 792
793static void usbhsg_uep_init(struct usbhsg_gpriv *gpriv)
794{
795 int i;
796 struct usbhsg_uep *uep;
797
798 usbhsg_for_each_uep_with_dcp(uep, gpriv, i)
799 uep->pipe = NULL;
800}
801
796/* 802/*
797 * 803 *
798 * usb_ep_ops 804 * usb_ep_ops
@@ -809,6 +815,13 @@ static int usbhsg_ep_enable(struct usb_ep *ep,
809 unsigned long flags; 815 unsigned long flags;
810 int ret = -EIO; 816 int ret = -EIO;
811 817
818 /*
819 * if it already have pipe,
820 * nothing to do
821 */
822 if (uep->pipe)
823 return 0;
824
812 /******************** spin lock ********************/ 825 /******************** spin lock ********************/
813 spin_lock_irqsave(lock, flags); 826 spin_lock_irqsave(lock, flags);
814 827
@@ -1045,6 +1058,7 @@ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status)
1045 * pipe initialize and enable DCP 1058 * pipe initialize and enable DCP
1046 */ 1059 */
1047 usbhs_pipe_init(priv); 1060 usbhs_pipe_init(priv);
1061 usbhsg_uep_init(gpriv);
1048 usbhsg_dcp_enable(dcp); 1062 usbhsg_dcp_enable(dcp);
1049 1063
1050 /* 1064 /*