Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280874
b: refs/heads/master
c: 4825093
h: refs/heads/master
v: v3
  • Loading branch information
Kuninori Morimoto authored and Felipe Balbi committed Dec 12, 2011
1 parent 86031f1 commit 5ffbb54
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3eddc9e4c828dbbeabb5924266bfded42a1ac042
refs/heads/master: 4825093e9d0692a2a1f1615ab69246ac07b17f2f
37 changes: 17 additions & 20 deletions trunk/drivers/usb/renesas_usbhs/mod_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,14 @@ static void usbhsh_device_free(struct usbhsh_hpriv *hpriv,
/*
* end-point control
*/
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)
static int usbhsh_endpoint_attach(struct usbhsh_hpriv *hpriv,
struct urb *urb,
gfp_t mem_flags)
{
struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv);
struct usb_device *usbv = usbhsh_urb_to_usbv(urb);
struct usbhsh_device *udev = usbhsh_usbv_to_udev(usbv);
struct usb_host_endpoint *ep = urb->ep;
struct usbhsh_ep *uep;
struct usbhsh_pipe_info *info;
struct usbhs_pipe *best_pipe = NULL;
Expand All @@ -357,7 +358,7 @@ static struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,
uep = kzalloc(sizeof(struct usbhsh_ep), mem_flags);
if (!uep) {
dev_err(dev, "usbhsh_ep alloc fail\n");
return NULL;
return -ENOMEM;
}

/******************** spin lock ********************/
Expand All @@ -374,10 +375,9 @@ static struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,
} else {
struct usbhs_pipe *pipe;
unsigned int min_usr = ~0;
int dir_in_req = !!usb_pipein(urb->pipe);
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;
Expand Down Expand Up @@ -410,7 +410,7 @@ static struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,
if (unlikely(!best_pipe)) {
dev_err(dev, "couldn't find best pipe\n");
kfree(uep);
return NULL;
return -EIO;
}

/*
Expand All @@ -437,11 +437,11 @@ static struct usbhsh_ep *usbhsh_endpoint_alloc(struct usbhsh_hpriv *hpriv,
usbhsh_device_number(hpriv, udev),
usbhs_pipe_name(uep->pipe), uep);

return uep;
return 0;
}

static void usbhsh_endpoint_free(struct usbhsh_hpriv *hpriv,
struct usb_host_endpoint *ep)
static void usbhsh_endpoint_detach(struct usbhsh_hpriv *hpriv,
struct usb_host_endpoint *ep)
{
struct usbhs_priv *priv = usbhsh_hpriv_to_priv(hpriv);
struct device *dev = usbhs_priv_to_dev(priv);
Expand Down Expand Up @@ -745,7 +745,6 @@ static int usbhsh_urb_enqueue(struct usb_hcd *hcd,
struct usb_device *usbv = usbhsh_urb_to_usbv(urb);
struct usb_host_endpoint *ep = urb->ep;
struct usbhsh_device *udev, *new_udev = NULL;
struct usbhsh_ep *uep;
int is_dir_in = usb_pipein(urb->pipe);

int ret;
Expand All @@ -769,13 +768,11 @@ static int usbhsh_urb_enqueue(struct usb_hcd *hcd,
}

/*
* get uep
* attach endpoint if needed
*/
uep = usbhsh_ep_to_uep(ep);
if (!uep) {
uep = usbhsh_endpoint_alloc(hpriv, udev, ep,
is_dir_in, mem_flags);
if (!uep)
if (!usbhsh_ep_to_uep(ep)) {
ret = usbhsh_endpoint_attach(hpriv, urb, mem_flags);
if (ret < 0)
goto usbhsh_urb_enqueue_error_free_device;
}

Expand Down Expand Up @@ -827,7 +824,7 @@ static void usbhsh_endpoint_disable(struct usb_hcd *hcd,
udev = usbhsh_uep_to_udev(uep);
hpriv = usbhsh_hcd_to_hpriv(hcd);

usbhsh_endpoint_free(hpriv, ep);
usbhsh_endpoint_detach(hpriv, ep);

/*
* if there is no endpoint,
Expand Down

0 comments on commit 5ffbb54

Please sign in to comment.