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-dbgtty.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-dbgtty.c')
-rw-r--r-- | drivers/usb/host/xhci-dbgtty.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c index 9acf1efba36c..3231cec74a7a 100644 --- a/drivers/usb/host/xhci-dbgtty.c +++ b/drivers/usb/host/xhci-dbgtty.c @@ -455,6 +455,11 @@ void xhci_dbc_tty_unregister_device(struct xhci_dbc *dbc) xhci_dbc_free_requests(&port->write_pool); } +static const struct dbc_driver dbc_driver = { + .configure = xhci_dbc_tty_register_device, + .disconnect = xhci_dbc_tty_unregister_device, +}; + int xhci_dbc_tty_probe(struct xhci_hcd *xhci) { struct xhci_dbc *dbc = xhci->dbc; @@ -465,6 +470,8 @@ int xhci_dbc_tty_probe(struct xhci_hcd *xhci) if (status) return status; + dbc->driver = &dbc_driver; + dbc_tty_driver->driver_state = &dbc->port; return 0; @@ -481,6 +488,8 @@ out: */ void xhci_dbc_tty_remove(struct xhci_dbc *dbc) { + dbc->driver = NULL; + /* dbc_tty_exit will be called by module_exit() in the future */ dbc_tty_exit(); } @@ -523,5 +532,3 @@ static void dbc_tty_exit(void) dbc_tty_driver = NULL; } } - - |