diff options
author | Mathias Nyman <mathias.nyman@linux.intel.com> | 2020-07-23 17:45:29 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-07-23 17:05:29 +0200 |
commit | 688915b11aa7f8b92d12a2e4672d71e3626a0e6a (patch) | |
tree | 60f13d1b7ec88b88b90c48334e713e39bbdad2da /drivers/usb/host/xhci-dbgcap.c | |
parent | 6ae6470bfa330d0b8892e02888bf5dac2272c28d (diff) | |
download | lwn-688915b11aa7f8b92d12a2e4672d71e3626a0e6a.tar.gz lwn-688915b11aa7f8b92d12a2e4672d71e3626a0e6a.zip |
xhci: dbgcap: remove dbc dependency on dbctty specific flag
dbc should not be aware of, or use any dbctty specific variables.
currenly dbc driver reads the port->registered flag to see if the
callbacks should be called.
Only makes these decisions based on dbc internal state instead.
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20200723144530.9992-27-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/xhci-dbgcap.c')
-rw-r--r-- | drivers/usb/host/xhci-dbgcap.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index 47090bceae21..c57178db7994 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -630,14 +630,22 @@ static void xhci_dbc_stop(struct xhci_dbc *dbc) { int ret; unsigned long flags; - struct dbc_port *port = &dbc->port; WARN_ON(!dbc); - cancel_delayed_work_sync(&dbc->event_work); + switch (dbc->state) { + case DS_DISABLED: + return; + case DS_CONFIGURED: + case DS_STALLED: + if (dbc->driver->disconnect) + dbc->driver->disconnect(dbc); + break; + default: + break; + } - if (port->registered && dbc->driver->disconnect) - dbc->driver->disconnect(dbc); + cancel_delayed_work_sync(&dbc->event_work); spin_lock_irqsave(&dbc->lock, flags); ret = xhci_do_dbc_stop(dbc); |