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>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
4521f16139
commit
6ae6470bfa
@@ -112,6 +112,11 @@ struct dbc_port {
|
||||
bool registered;
|
||||
};
|
||||
|
||||
struct dbc_driver {
|
||||
int (*configure)(struct xhci_dbc *dbc);
|
||||
void (*disconnect)(struct xhci_dbc *dbc);
|
||||
};
|
||||
|
||||
struct xhci_dbc {
|
||||
spinlock_t lock; /* device access */
|
||||
struct device *dev;
|
||||
@@ -133,6 +138,7 @@ struct xhci_dbc {
|
||||
struct dbc_ep eps[2];
|
||||
|
||||
struct dbc_port port;
|
||||
const struct dbc_driver *driver;
|
||||
};
|
||||
|
||||
struct dbc_request {
|
||||
@@ -192,8 +198,6 @@ int xhci_dbc_init(struct xhci_hcd *xhci);
|
||||
void xhci_dbc_exit(struct xhci_hcd *xhci);
|
||||
int xhci_dbc_tty_probe(struct xhci_hcd *xhci);
|
||||
void xhci_dbc_tty_remove(struct xhci_dbc *dbc);
|
||||
int xhci_dbc_tty_register_device(struct xhci_dbc *dbc);
|
||||
void xhci_dbc_tty_unregister_device(struct xhci_dbc *dbc);
|
||||
struct dbc_request *dbc_alloc_request(struct xhci_dbc *dbc,
|
||||
unsigned int direction,
|
||||
gfp_t flags);
|
||||
|
Reference in New Issue
Block a user