usb: phy: generic: remove the vbus dependency
authorRobert Jarzmik <robert.jarzmik@free.fr>
Fri, 8 Jul 2016 20:09:07 +0000 (22:09 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 25 Aug 2016 09:13:07 +0000 (12:13 +0300)
As the last known user, ie. pxa27x_udc relying on calls to
usb_gadget_xxx() was amended to use the phy notifier, remove a bit the
USB stack adherence.

Actually the driver still uses the gadget API for structures definition,
but the implementation of USB gadget specific function usb_gadget_*() is
not necessary anymore.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/phy/phy-generic.c

index 41b8aff9b925d3ab48382fdc67355aadc9e09ae6..c14e767a3fbf074f573380592760c8e038c49b87 100644 (file)
@@ -118,8 +118,6 @@ static irqreturn_t nop_gpio_vbus_thread(int irq, void *data)
                status = USB_EVENT_VBUS;
                otg->state = OTG_STATE_B_PERIPHERAL;
                nop->phy.last_event = status;
-               if (otg->gadget)
-                       usb_gadget_vbus_connect(otg->gadget);
 
                /* drawing a "unit load" is *always* OK, except for OTG */
                nop_set_vbus_draw(nop, 100);
@@ -129,8 +127,6 @@ static irqreturn_t nop_gpio_vbus_thread(int irq, void *data)
        } else {
                nop_set_vbus_draw(nop, 0);
 
-               if (otg->gadget)
-                       usb_gadget_vbus_disconnect(otg->gadget);
                status = USB_EVENT_NONE;
                otg->state = OTG_STATE_B_IDLE;
                nop->phy.last_event = status;
@@ -187,7 +183,8 @@ static int nop_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget)
 
        otg->gadget = gadget;
        if (otg->state == OTG_STATE_B_PERIPHERAL)
-               usb_gadget_vbus_connect(gadget);
+               atomic_notifier_call_chain(&otg->usb_phy->notifier,
+                                          USB_EVENT_VBUS, otg->gadget);
        else
                otg->state = OTG_STATE_B_IDLE;
        return 0;