mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-05 06:08:22 +00:00
xhci: dbgtty: Pass dbc pointer when registering a dbctty device
Pass dbc pointer to the xhci_dbc_tty_register_device() and xhci_dbc_tty_unregister_device() functions instead of xhci_hcd pointer These functions don't need a xhci_hcd pointer anymore, only use case was the xhci_err() function, which is now changed to a dev_err() instead. No functional changes This change helps decoupling xhci and DbC Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20200723144530.9992-16-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a1f6376df4
commit
b396fa39de
3 changed files with 8 additions and 12 deletions
|
@ -545,7 +545,7 @@ static void xhci_dbc_stop(struct xhci_hcd *xhci)
|
|||
cancel_delayed_work_sync(&dbc->event_work);
|
||||
|
||||
if (port->registered)
|
||||
xhci_dbc_tty_unregister_device(xhci);
|
||||
xhci_dbc_tty_unregister_device(dbc);
|
||||
|
||||
spin_lock_irqsave(&dbc->lock, flags);
|
||||
ret = xhci_do_dbc_stop(dbc);
|
||||
|
@ -789,10 +789,8 @@ static void xhci_dbc_handle_events(struct work_struct *work)
|
|||
enum evtreturn evtr;
|
||||
struct xhci_dbc *dbc;
|
||||
unsigned long flags;
|
||||
struct xhci_hcd *xhci;
|
||||
|
||||
dbc = container_of(to_delayed_work(work), struct xhci_dbc, event_work);
|
||||
xhci = dbc->xhci;
|
||||
|
||||
spin_lock_irqsave(&dbc->lock, flags);
|
||||
evtr = xhci_dbc_do_handle_events(dbc);
|
||||
|
@ -800,7 +798,7 @@ static void xhci_dbc_handle_events(struct work_struct *work)
|
|||
|
||||
switch (evtr) {
|
||||
case EVT_GSER:
|
||||
ret = xhci_dbc_tty_register_device(xhci);
|
||||
ret = xhci_dbc_tty_register_device(dbc);
|
||||
if (ret) {
|
||||
dev_err(dbc->dev, "failed to alloc tty device\n");
|
||||
break;
|
||||
|
@ -809,7 +807,7 @@ static void xhci_dbc_handle_events(struct work_struct *work)
|
|||
dev_info(dbc->dev, "DbC now attached to /dev/ttyDBC0\n");
|
||||
break;
|
||||
case EVT_DISC:
|
||||
xhci_dbc_tty_unregister_device(xhci);
|
||||
xhci_dbc_tty_unregister_device(dbc);
|
||||
break;
|
||||
case EVT_DONE:
|
||||
break;
|
||||
|
|
|
@ -198,8 +198,8 @@ int xhci_dbc_init(struct xhci_hcd *xhci);
|
|||
void xhci_dbc_exit(struct xhci_hcd *xhci);
|
||||
int xhci_dbc_tty_register_driver(struct xhci_hcd *xhci);
|
||||
void xhci_dbc_tty_unregister_driver(void);
|
||||
int xhci_dbc_tty_register_device(struct xhci_hcd *xhci);
|
||||
void xhci_dbc_tty_unregister_device(struct xhci_hcd *xhci);
|
||||
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 dbc_ep *dep, gfp_t gfp_flags);
|
||||
void dbc_free_request(struct dbc_ep *dep, struct dbc_request *req);
|
||||
int dbc_ep_queue(struct dbc_ep *dep, struct dbc_request *req, gfp_t gfp_flags);
|
||||
|
|
|
@ -440,11 +440,10 @@ xhci_dbc_tty_exit_port(struct dbc_port *port)
|
|||
tty_port_destroy(&port->port);
|
||||
}
|
||||
|
||||
int xhci_dbc_tty_register_device(struct xhci_hcd *xhci)
|
||||
int xhci_dbc_tty_register_device(struct xhci_dbc *dbc)
|
||||
{
|
||||
int ret;
|
||||
struct device *tty_dev;
|
||||
struct xhci_dbc *dbc = xhci->dbc;
|
||||
struct dbc_port *port = &dbc->port;
|
||||
|
||||
xhci_dbc_tty_init_port(xhci, port);
|
||||
|
@ -484,14 +483,13 @@ buf_alloc_fail:
|
|||
register_fail:
|
||||
xhci_dbc_tty_exit_port(port);
|
||||
|
||||
xhci_err(xhci, "can't register tty port, err %d\n", ret);
|
||||
dev_err(dbc->dev, "can't register tty port, err %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void xhci_dbc_tty_unregister_device(struct xhci_hcd *xhci)
|
||||
void xhci_dbc_tty_unregister_device(struct xhci_dbc *dbc)
|
||||
{
|
||||
struct xhci_dbc *dbc = xhci->dbc;
|
||||
struct dbc_port *port = &dbc->port;
|
||||
|
||||
tty_unregister_device(dbc_tty_driver, 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue