Commit 25427874 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Greg Kroah-Hartman

usb: gadget: dummy_hcd: use dummy_pullup() instead of open coding

The removed code does the same thing as dummy_pullup(). The only
difference is that in dummy_udc_stop() the first dummy_pullup()
did not call usb_hcd_poll_rh_status().
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e9c23a25
...@@ -944,31 +944,21 @@ static int dummy_udc_start(struct usb_gadget_driver *driver, ...@@ -944,31 +944,21 @@ static int dummy_udc_start(struct usb_gadget_driver *driver,
return retval; return retval;
} }
/* khubd will enumerate this in a while */ if (dum->gadget.speed == USB_SPEED_SUPER)
spin_lock_irq (&dum->lock);
dum->pullup = 1;
if (dum->gadget.speed == USB_SPEED_SUPER) {
dum->gadget.is_otg = dum->gadget.is_otg =
(dummy_hcd_to_hcd(dum->ss_hcd)->self.otg_port != 0); (dummy_hcd_to_hcd(dum->ss_hcd)->self.otg_port != 0);
set_link_state(dum->ss_hcd); else
} else {
dum->gadget.is_otg = dum->gadget.is_otg =
(dummy_hcd_to_hcd(dum->hs_hcd)->self.otg_port != 0); (dummy_hcd_to_hcd(dum->hs_hcd)->self.otg_port != 0);
set_link_state(dum->hs_hcd);
}
spin_unlock_irq (&dum->lock); /* khubd will enumerate this in a while */
dummy_pullup(&dum->gadget, 1);
usb_hcd_poll_rh_status((dum->gadget.speed == USB_SPEED_SUPER ?
dummy_hcd_to_hcd(dum->ss_hcd) :
dummy_hcd_to_hcd(dum->hs_hcd)));
return 0; return 0;
} }
static int dummy_udc_stop(struct usb_gadget_driver *driver) static int dummy_udc_stop(struct usb_gadget_driver *driver)
{ {
struct dummy *dum = &the_controller; struct dummy *dum = &the_controller;
unsigned long flags;
if (!dum) if (!dum)
return -ENODEV; return -ENODEV;
...@@ -978,23 +968,13 @@ static int dummy_udc_stop(struct usb_gadget_driver *driver) ...@@ -978,23 +968,13 @@ static int dummy_udc_stop(struct usb_gadget_driver *driver)
dev_dbg (udc_dev(dum), "unregister gadget driver '%s'\n", dev_dbg (udc_dev(dum), "unregister gadget driver '%s'\n",
driver->driver.name); driver->driver.name);
spin_lock_irqsave (&dum->lock, flags); dummy_pullup(&dum->gadget, 0);
dum->pullup = 0;
set_link_state((dum->gadget.speed == USB_SPEED_SUPER ?
dum->ss_hcd : dum->hs_hcd));
spin_unlock_irqrestore (&dum->lock, flags);
driver->unbind (&dum->gadget); driver->unbind (&dum->gadget);
dum->gadget.dev.driver = NULL; dum->gadget.dev.driver = NULL;
dum->driver = NULL; dum->driver = NULL;
spin_lock_irqsave (&dum->lock, flags);
dum->pullup = 0; dummy_pullup(&dum->gadget, 0);
set_link_state((dum->gadget.speed == USB_SPEED_SUPER ?
dum->ss_hcd : dum->hs_hcd));
spin_unlock_irqrestore (&dum->lock, flags);
usb_hcd_poll_rh_status((dum->gadget.speed == USB_SPEED_SUPER ?
dummy_hcd_to_hcd(dum->ss_hcd) :
dummy_hcd_to_hcd(dum->hs_hcd)));
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment