diff options
author | Mathias Nyman <mathias.nyman@linux.intel.com> | 2020-07-23 17:45:28 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-07-23 17:05:29 +0200 |
commit | 6ae6470bfa330d0b8892e02888bf5dac2272c28d (patch) | |
tree | 334242ee5eb63fe82db59b5048172c05d4441062 /drivers/usb/host/xhci-dbgcap.c | |
parent | 4521f16139409cdf9462c7325d43454462cff6c3 (diff) |
xhci: dbc: Add a operations structure to access driver functions
Don't call dbctty driver functions directly from dbc core code.
Introduce a new dbc_driver structure that contains function pointers
for disconnect and configure operations.
The driver (ttydbc) must provide these opeations when creating a dbc.
Name the structure dbc_driver instead of dbc_ops as we plan to
add more driver configureable values here, such as vid and pid.
Decouples dbc and dbctty.
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20200723144530.9992-26-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 | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index 99f0b425274a..47090bceae21 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -636,8 +636,8 @@ static void xhci_dbc_stop(struct xhci_dbc *dbc) cancel_delayed_work_sync(&dbc->event_work); - if (port->registered) - xhci_dbc_tty_unregister_device(dbc); + if (port->registered && dbc->driver->disconnect) + dbc->driver->disconnect(dbc); spin_lock_irqsave(&dbc->lock, flags); ret = xhci_do_dbc_stop(dbc); @@ -877,7 +877,6 @@ static enum evtreturn xhci_dbc_do_handle_events(struct xhci_dbc *dbc) static void xhci_dbc_handle_events(struct work_struct *work) { - int ret; enum evtreturn evtr; struct xhci_dbc *dbc; unsigned long flags; @@ -890,16 +889,12 @@ static void xhci_dbc_handle_events(struct work_struct *work) switch (evtr) { case EVT_GSER: - ret = xhci_dbc_tty_register_device(dbc); - if (ret) { - dev_err(dbc->dev, "failed to alloc tty device\n"); - break; - } - - dev_info(dbc->dev, "DbC now attached to /dev/ttyDBC0\n"); + if (dbc->driver->configure) + dbc->driver->configure(dbc); break; case EVT_DISC: - xhci_dbc_tty_unregister_device(dbc); + if (dbc->driver->disconnect) + dbc->driver->disconnect(dbc); break; case EVT_DONE: break; |