]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/musb/musb_core.c
ARM: OMAP: musb_vbus_store(): dont exit with spinlock held
[linux-2.6-omap-h63xx.git] / drivers / usb / musb / musb_core.c
index 65f288e4d8202c89202dec2d51f7de44ae82f8c5..9a73de521a868da4a8a464d965d21c94b8bc8ea2 100644 (file)
@@ -642,6 +642,9 @@ static irqreturn_t musb_stage0_irq(struct musb * musb, u8 int_usb,
                        case OTG_STATE_A_WAIT_BCON:     /* OPT TD.4.7-900ms */
                                musb_hnp_stop(musb);
                                break;
+                       case OTG_STATE_B_IDLE:
+                               musb->xceiv.state = OTG_STATE_B_PERIPHERAL;
+                               /* FALLTHROUGH */
                        case OTG_STATE_B_PERIPHERAL:
                                musb_g_reset(musb);
                                break;
@@ -1709,11 +1712,12 @@ musb_vbus_store(struct device *dev, struct device_attribute *attr,
        unsigned long   flags;
        unsigned long   val;
 
-       spin_lock_irqsave(&musb->lock, flags);
        if (sscanf(buf, "%lu", &val) < 1) {
                printk(KERN_ERR "Invalid VBUS timeout ms value\n");
                return -EINVAL;
        }
+
+       spin_lock_irqsave(&musb->lock, flags);
        musb->a_wait_bcon = val;
        if (musb->xceiv.state == OTG_STATE_A_WAIT_BCON)
                musb->is_active = 0;
@@ -1825,6 +1829,9 @@ allocate_instance(struct device *dev, void __iomem *mbase)
                ep->epnum = epnum;
        }
 
+#ifdef CONFIG_USB_MUSB_OTG
+       otg_set_transceiver(&musb->xceiv);
+#endif
        musb->controller = dev;
        return musb;
 }
@@ -1869,6 +1876,10 @@ static void musb_free(struct musb *musb)
                clk_put(musb->clock);
        }
 
+#ifdef CONFIG_USB_MUSB_OTG
+       put_device(musb->xceiv.dev);
+#endif
+
 #ifdef CONFIG_USB_MUSB_HDRC_HCD
        usb_put_hcd(musb_to_hcd(musb));
 #else