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
*/
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;
* 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);
/*
* 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);