From: Mathias Nyman Date: Thu, 23 Jul 2020 14:45:18 +0000 (+0300) Subject: xhci: dbgtty: Pass dbc pointer when registering a dbctty device X-Git-Tag: v5.10.7~1952^2~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b396fa39de9b47ce3368f65d7d069c7176f26371;p=platform%2Fkernel%2Flinux-rpi.git 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 Link: https://lore.kernel.org/r/20200723144530.9992-16-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index 1c53fdc..dd8ac59 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -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; diff --git a/drivers/usb/host/xhci-dbgcap.h b/drivers/usb/host/xhci-dbgcap.h index 7ca2f4c..628f85f 100644 --- a/drivers/usb/host/xhci-dbgcap.h +++ b/drivers/usb/host/xhci-dbgcap.h @@ -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); diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c index 9a1d384..545e8cb 100644 --- a/drivers/usb/host/xhci-dbgtty.c +++ b/drivers/usb/host/xhci-dbgtty.c @@ -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);