From f500e69a20ae82b5bdf2fee3f2b4f3234ff20e10 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 8 Dec 2011 18:30:23 -0800 Subject: [PATCH] --- yaml --- r: 280899 b: refs/heads/master c: b1930da08872f6e17b8cdca60ee9c7321a8b5b8c h: refs/heads/master i: 280897: 1f7ab943a558f5124cc8b01601b5412bbbecb39e 280895: aeabf0fab9bb2efa298f0cfd8205ade8c1adce9b v: v3 --- [refs] | 2 +- trunk/drivers/usb/renesas_usbhs/mod_host.c | 32 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index f2e8b31350b6..8bae2c478996 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 31e00fd116cab296da2d12bc0b82a30a9fbdd681 +refs/heads/master: b1930da08872f6e17b8cdca60ee9c7321a8b5b8c diff --git a/trunk/drivers/usb/renesas_usbhs/mod_host.c b/trunk/drivers/usb/renesas_usbhs/mod_host.c index c947d0aca9bf..28b2cb3a029a 100644 --- a/trunk/drivers/usb/renesas_usbhs/mod_host.c +++ b/trunk/drivers/usb/renesas_usbhs/mod_host.c @@ -190,6 +190,21 @@ static void usbhsh_ureq_free(struct usbhsh_hpriv *hpriv, kfree(ureq); } +/* + * status + */ +static int usbhsh_is_running(struct usbhsh_hpriv *hpriv) +{ + /* + * we can decide some device is attached or not + * by checking mod.irq_attch + * see + * usbhsh_irq_attch() + * usbhsh_irq_dtch() + */ + return (hpriv->mod.irq_attch == NULL); +} + /* * pipe control */ @@ -900,6 +915,11 @@ static int usbhsh_urb_enqueue(struct usb_hcd *hcd, dev_dbg(dev, "%s (%s)\n", __func__, is_dir_in ? "in" : "out"); + if (!usbhsh_is_running(hpriv)) { + ret = -EIO; + goto usbhsh_urb_enqueue_error_not_linked; + } + ret = usb_hcd_link_urb_to_ep(hcd, urb); if (ret) goto usbhsh_urb_enqueue_error_not_linked; @@ -1249,6 +1269,12 @@ static int usbhsh_irq_attch(struct usbhs_priv *priv, * attch interrupt might happen infinitely on some device * (on self power USB hub ?) * disable it here. + * + * usbhsh_is_running() becomes effective + * according to this process. + * see + * usbhsh_is_running() + * usbhsh_urb_enqueue() */ hpriv->mod.irq_attch = NULL; usbhs_irq_callback_update(priv, &hpriv->mod); @@ -1269,6 +1295,12 @@ static int usbhsh_irq_dtch(struct usbhs_priv *priv, /* * enable attch interrupt again + * + * usbhsh_is_running() becomes invalid + * according to this process. + * see + * usbhsh_is_running() + * usbhsh_urb_enqueue() */ hpriv->mod.irq_attch = usbhsh_irq_attch; usbhs_irq_callback_update(priv, &hpriv->mod);