Commit f39f3afd authored by Mathias Nyman's avatar Mathias Nyman Committed by Greg Kroah-Hartman

xhci: dbc: Use dbc structure in the request completion instead of xhci_hcd

The dbc request completion callback doesn't need a xhci_hcd pointer.
The only user of the xhci_hcd pointer in dbgtty request callback was
the xhci_warn() function. Change it to dev_warn() instead.

While changing the callback function parameter to dbc in struct
xhci_requeset, move the struct xhci_request declaraion down a bit in the
header file to avoid compiler warinings

No functional changes
This change helps decoupling xhci and DbC
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20200723144530.9992-18-mathias.nyman@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 91aaf974
...@@ -114,8 +114,7 @@ static void xhci_dbc_giveback(struct dbc_request *req, int status) ...@@ -114,8 +114,7 @@ static void xhci_dbc_giveback(struct dbc_request *req, int status)
{ {
struct dbc_ep *dep = req->dep; struct dbc_ep *dep = req->dep;
struct xhci_dbc *dbc = dep->dbc; struct xhci_dbc *dbc = dep->dbc;
struct xhci_hcd *xhci = dbc->xhci; struct device *dev = dbc->dev;
struct device *dev = xhci_to_hcd(dbc->xhci)->self.sysdev;
list_del_init(&req->list_pending); list_del_init(&req->list_pending);
req->trb_dma = 0; req->trb_dma = 0;
...@@ -133,7 +132,7 @@ static void xhci_dbc_giveback(struct dbc_request *req, int status) ...@@ -133,7 +132,7 @@ static void xhci_dbc_giveback(struct dbc_request *req, int status)
/* Give back the transfer request: */ /* Give back the transfer request: */
spin_unlock(&dbc->lock); spin_unlock(&dbc->lock);
req->complete(xhci, req); req->complete(dbc, req);
spin_lock(&dbc->lock); spin_lock(&dbc->lock);
} }
......
...@@ -84,23 +84,6 @@ enum dbc_state { ...@@ -84,23 +84,6 @@ enum dbc_state {
DS_STALLED, DS_STALLED,
}; };
struct dbc_request {
void *buf;
unsigned int length;
dma_addr_t dma;
void (*complete)(struct xhci_hcd *xhci,
struct dbc_request *req);
struct list_head list_pool;
int status;
unsigned int actual;
struct dbc_ep *dep;
struct list_head list_pending;
dma_addr_t trb_dma;
union xhci_trb *trb;
unsigned direction:1;
};
struct dbc_ep { struct dbc_ep {
struct xhci_dbc *dbc; struct xhci_dbc *dbc;
struct list_head list_pending; struct list_head list_pending;
...@@ -154,6 +137,23 @@ struct xhci_dbc { ...@@ -154,6 +137,23 @@ struct xhci_dbc {
struct dbc_port port; struct dbc_port port;
}; };
struct dbc_request {
void *buf;
unsigned int length;
dma_addr_t dma;
void (*complete)(struct xhci_dbc *dbc,
struct dbc_request *req);
struct list_head list_pool;
int status;
unsigned int actual;
struct dbc_ep *dep;
struct list_head list_pending;
dma_addr_t trb_dma;
union xhci_trb *trb;
unsigned direction:1;
};
#define dbc_bulkout_ctx(d) \ #define dbc_bulkout_ctx(d) \
((struct xhci_ep_ctx *)((d)->ctx->bytes + DBC_CONTEXT_SIZE)) ((struct xhci_ep_ctx *)((d)->ctx->bytes + DBC_CONTEXT_SIZE))
#define dbc_bulkin_ctx(d) \ #define dbc_bulkin_ctx(d) \
......
...@@ -91,10 +91,9 @@ static void dbc_start_rx(struct dbc_port *port) ...@@ -91,10 +91,9 @@ static void dbc_start_rx(struct dbc_port *port)
} }
static void static void
dbc_read_complete(struct xhci_hcd *xhci, struct dbc_request *req) dbc_read_complete(struct xhci_dbc *dbc, struct dbc_request *req)
{ {
unsigned long flags; unsigned long flags;
struct xhci_dbc *dbc = xhci->dbc;
struct dbc_port *port = &dbc->port; struct dbc_port *port = &dbc->port;
spin_lock_irqsave(&port->port_lock, flags); spin_lock_irqsave(&port->port_lock, flags);
...@@ -103,10 +102,9 @@ dbc_read_complete(struct xhci_hcd *xhci, struct dbc_request *req) ...@@ -103,10 +102,9 @@ dbc_read_complete(struct xhci_hcd *xhci, struct dbc_request *req)
spin_unlock_irqrestore(&port->port_lock, flags); spin_unlock_irqrestore(&port->port_lock, flags);
} }
static void dbc_write_complete(struct xhci_hcd *xhci, struct dbc_request *req) static void dbc_write_complete(struct xhci_dbc *dbc, struct dbc_request *req)
{ {
unsigned long flags; unsigned long flags;
struct xhci_dbc *dbc = xhci->dbc;
struct dbc_port *port = &dbc->port; struct dbc_port *port = &dbc->port;
spin_lock_irqsave(&port->port_lock, flags); spin_lock_irqsave(&port->port_lock, flags);
...@@ -118,7 +116,7 @@ static void dbc_write_complete(struct xhci_hcd *xhci, struct dbc_request *req) ...@@ -118,7 +116,7 @@ static void dbc_write_complete(struct xhci_hcd *xhci, struct dbc_request *req)
case -ESHUTDOWN: case -ESHUTDOWN:
break; break;
default: default:
xhci_warn(xhci, "unexpected write complete status %d\n", dev_warn(dbc->dev, "unexpected write complete status %d\n",
req->status); req->status);
break; break;
} }
...@@ -133,7 +131,7 @@ static void xhci_dbc_free_req(struct dbc_ep *dep, struct dbc_request *req) ...@@ -133,7 +131,7 @@ static void xhci_dbc_free_req(struct dbc_ep *dep, struct dbc_request *req)
static int static int
xhci_dbc_alloc_requests(struct dbc_ep *dep, struct list_head *head, xhci_dbc_alloc_requests(struct dbc_ep *dep, struct list_head *head,
void (*fn)(struct xhci_hcd *, struct dbc_request *)) void (*fn)(struct xhci_dbc *, struct dbc_request *))
{ {
int i; int i;
struct dbc_request *req; struct dbc_request *req;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment