From ceb3460b6101f05f7169ec1803939e3673cbad08 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 31 Oct 2011 00:48:22 -0700 Subject: [PATCH] --- yaml --- r: 280872 b: refs/heads/master c: f352741d2704a480a927160be8c910570bf51238 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/usb/renesas_usbhs/mod_host.c | 59 ++++++++++------------ 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/[refs] b/[refs] index 89c31f443617..68bb5f8a40c5 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d399f90d192f4cbda2527d42d054d090e327a9a0 +refs/heads/master: f352741d2704a480a927160be8c910570bf51238 diff --git a/trunk/drivers/usb/renesas_usbhs/mod_host.c b/trunk/drivers/usb/renesas_usbhs/mod_host.c index 1816a3e11b78..e09b64a92a4e 100644 --- a/trunk/drivers/usb/renesas_usbhs/mod_host.c +++ b/trunk/drivers/usb/renesas_usbhs/mod_host.c @@ -340,36 +340,26 @@ static void usbhsh_device_free(struct usbhsh_hpriv *hpriv, /* * end-point control */ -struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv, +static struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv, struct usbhsh_device *udev, struct usb_host_endpoint *ep, int dir_in_req, gfp_t mem_flags) { struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv); - struct usb_hcd *hcd = usbhsh_hpriv_to_hcd(hpriv); struct usbhsh_ep *uep; struct usbhsh_pipe_info *info; - struct usbhs_pipe *pipe, *best_pipe; - struct device *dev = usbhsh_hcd_to_dev(hcd); + struct usbhs_pipe *best_pipe = NULL; + struct device *dev = usbhs_priv_to_dev(priv); struct usb_endpoint_descriptor *desc = &ep->desc; - int type, i, dir_in; - unsigned int min_usr; unsigned long flags; - dir_in_req = !!dir_in_req; - uep = kzalloc(sizeof(struct usbhsh_ep), mem_flags); if (!uep) { dev_err(dev, "usbhsh_ep alloc fail\n"); return NULL; } - if (usb_endpoint_xfer_control(desc)) { - best_pipe = usbhsh_hpriv_to_dcp(hpriv); - goto usbhsh_endpoint_alloc_find_pipe; - } - /******************** spin lock ********************/ usbhs_lock(priv, flags); @@ -378,22 +368,29 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv, * see * HARDWARE LIMITATION */ - type = usb_endpoint_type(desc); - min_usr = ~0; - best_pipe = NULL; - usbhs_for_each_pipe(pipe, priv, i) { - if (!usbhs_pipe_type_is(pipe, type)) - continue; - - dir_in = !!usbhs_pipe_is_dir_in(pipe); - if (0 != (dir_in - dir_in_req)) - continue; - - info = usbhsh_pipe_info(pipe); - - if (min_usr > info->usr_cnt) { - min_usr = info->usr_cnt; - best_pipe = pipe; + if (usb_endpoint_xfer_control(desc)) { + /* best pipe is DCP */ + best_pipe = usbhsh_hpriv_to_dcp(hpriv); + } else { + struct usbhs_pipe *pipe; + unsigned int min_usr = ~0; + int i, dir_in; + + dir_in_req = !!dir_in_req; + + usbhs_for_each_pipe(pipe, priv, i) { + if (!usbhs_pipe_type_is(pipe, usb_endpoint_type(desc))) + continue; + + dir_in = !!usbhs_pipe_is_dir_in(pipe); + if (0 != (dir_in - dir_in_req)) + continue; + + info = usbhsh_pipe_info(pipe); + if (min_usr > info->usr_cnt) { + min_usr = info->usr_cnt; + best_pipe = pipe; + } } } @@ -415,7 +412,7 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv, kfree(uep); return NULL; } -usbhsh_endpoint_alloc_find_pipe: + /* * init uep */ @@ -443,7 +440,7 @@ struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv, return uep; } -void usbhsh_endpoint_free(struct usbhsh_hpriv *hpriv, +static void usbhsh_endpoint_free(struct usbhsh_hpriv *hpriv, struct usb_host_endpoint *ep) { struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv);