usb: gadget: dummy-hcd: use udc-core's reset notifier
Replace usb_gadget_driver's disconnect with udc-core's reset notifier at bus reset handler. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Peter chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
1189f7f6dc
commit
8480484d6f
|
@ -367,19 +367,22 @@ static void set_link_state(struct dummy_hcd *dum_hcd)
|
||||||
dum_hcd->active)
|
dum_hcd->active)
|
||||||
dum_hcd->resuming = 0;
|
dum_hcd->resuming = 0;
|
||||||
|
|
||||||
/* if !connected or reset */
|
/* Currently !connected or in reset */
|
||||||
if ((dum_hcd->port_status & USB_PORT_STAT_CONNECTION) == 0 ||
|
if ((dum_hcd->port_status & USB_PORT_STAT_CONNECTION) == 0 ||
|
||||||
(dum_hcd->port_status & USB_PORT_STAT_RESET) != 0) {
|
(dum_hcd->port_status & USB_PORT_STAT_RESET) != 0) {
|
||||||
/*
|
unsigned disconnect = USB_PORT_STAT_CONNECTION &
|
||||||
* We're connected and not reset (reset occurred now),
|
dum_hcd->old_status & (~dum_hcd->port_status);
|
||||||
* and driver attached - disconnect!
|
unsigned reset = USB_PORT_STAT_RESET &
|
||||||
*/
|
(~dum_hcd->old_status) & dum_hcd->port_status;
|
||||||
if ((dum_hcd->old_status & USB_PORT_STAT_CONNECTION) != 0 &&
|
|
||||||
(dum_hcd->old_status & USB_PORT_STAT_RESET) == 0 &&
|
/* Report reset and disconnect events to the driver */
|
||||||
dum->driver) {
|
if (dum->driver && (disconnect || reset)) {
|
||||||
stop_activity(dum);
|
stop_activity(dum);
|
||||||
spin_unlock(&dum->lock);
|
spin_unlock(&dum->lock);
|
||||||
dum->driver->disconnect(&dum->gadget);
|
if (reset)
|
||||||
|
usb_gadget_udc_reset(&dum->gadget, dum->driver);
|
||||||
|
else
|
||||||
|
dum->driver->disconnect(&dum->gadget);
|
||||||
spin_lock(&dum->lock);
|
spin_lock(&dum->lock);
|
||||||
}
|
}
|
||||||
} else if (dum_hcd->active != dum_hcd->old_active) {
|
} else if (dum_hcd->active != dum_hcd->old_active) {
|
||||||
|
|
Loading…
Reference in New Issue