mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 13:43:51 +00:00
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>
This commit is contained in:
parent
6ae6470bfa
commit
688915b11a
@ -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);
|
||||
|
@ -399,6 +399,9 @@ int xhci_dbc_tty_register_device(struct xhci_dbc *dbc)
|
||||
struct device *tty_dev;
|
||||
struct dbc_port *port = &dbc->port;
|
||||
|
||||
if (port->registered)
|
||||
return -EBUSY;
|
||||
|
||||
xhci_dbc_tty_init_port(dbc, port);
|
||||
tty_dev = tty_port_register_device(&port->port,
|
||||
dbc_tty_driver, 0, NULL);
|
||||
@ -445,6 +448,8 @@ void xhci_dbc_tty_unregister_device(struct xhci_dbc *dbc)
|
||||
{
|
||||
struct dbc_port *port = &dbc->port;
|
||||
|
||||
if (!port->registered)
|
||||
return;
|
||||
tty_unregister_device(dbc_tty_driver, 0);
|
||||
xhci_dbc_tty_exit_port(port);
|
||||
port->registered = false;
|
||||
|
Loading…
Reference in New Issue
Block a user