All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>,
	Mathias Nyman <mathias.nyman@linux.intel.com>
Subject: [PATCH 17/27] xhci: dbc: Use dbc structure in the request completion instead of xhci_hcd
Date: Thu, 23 Jul 2020 17:45:20 +0300	[thread overview]
Message-ID: <20200723144530.9992-18-mathias.nyman@linux.intel.com> (raw)
In-Reply-To: <20200723144530.9992-1-mathias.nyman@linux.intel.com>

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: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 drivers/usb/host/xhci-dbgcap.c |  5 ++---
 drivers/usb/host/xhci-dbgcap.h | 34 +++++++++++++++++-----------------
 drivers/usb/host/xhci-dbgtty.c | 10 ++++------
 3 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c
index 26e693dd7414..2473100b955a 100644
--- a/drivers/usb/host/xhci-dbgcap.c
+++ b/drivers/usb/host/xhci-dbgcap.c
@@ -114,8 +114,7 @@ static void xhci_dbc_giveback(struct dbc_request *req, int status)
 {
 	struct dbc_ep		*dep = req->dep;
 	struct xhci_dbc		*dbc = dep->dbc;
-	struct xhci_hcd		*xhci = dbc->xhci;
-	struct device		*dev = xhci_to_hcd(dbc->xhci)->self.sysdev;
+	struct device		*dev = dbc->dev;
 
 	list_del_init(&req->list_pending);
 	req->trb_dma = 0;
@@ -133,7 +132,7 @@ static void xhci_dbc_giveback(struct dbc_request *req, int status)
 
 	/* Give back the transfer request: */
 	spin_unlock(&dbc->lock);
-	req->complete(xhci, req);
+	req->complete(dbc, req);
 	spin_lock(&dbc->lock);
 }
 
diff --git a/drivers/usb/host/xhci-dbgcap.h b/drivers/usb/host/xhci-dbgcap.h
index dc7d2d157e7b..9e3c5940f27b 100644
--- a/drivers/usb/host/xhci-dbgcap.h
+++ b/drivers/usb/host/xhci-dbgcap.h
@@ -84,23 +84,6 @@ enum dbc_state {
 	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 xhci_dbc			*dbc;
 	struct list_head		list_pending;
@@ -154,6 +137,23 @@ struct xhci_dbc {
 	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)		\
 	((struct xhci_ep_ctx *)((d)->ctx->bytes + DBC_CONTEXT_SIZE))
 #define dbc_bulkin_ctx(d)		\
diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c
index 0ef48862f4a7..967f0419dad7 100644
--- a/drivers/usb/host/xhci-dbgtty.c
+++ b/drivers/usb/host/xhci-dbgtty.c
@@ -91,10 +91,9 @@ static void dbc_start_rx(struct dbc_port *port)
 }
 
 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;
-	struct xhci_dbc		*dbc = xhci->dbc;
 	struct dbc_port		*port = &dbc->port;
 
 	spin_lock_irqsave(&port->port_lock, flags);
@@ -103,10 +102,9 @@ dbc_read_complete(struct xhci_hcd *xhci, struct dbc_request *req)
 	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;
-	struct xhci_dbc		*dbc = xhci->dbc;
 	struct dbc_port		*port = &dbc->port;
 
 	spin_lock_irqsave(&port->port_lock, flags);
@@ -118,7 +116,7 @@ static void dbc_write_complete(struct xhci_hcd *xhci, struct dbc_request *req)
 	case -ESHUTDOWN:
 		break;
 	default:
-		xhci_warn(xhci, "unexpected write complete status %d\n",
+		dev_warn(dbc->dev, "unexpected write complete status %d\n",
 			  req->status);
 		break;
 	}
@@ -133,7 +131,7 @@ static void xhci_dbc_free_req(struct dbc_ep *dep, struct dbc_request *req)
 
 static int
 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;
 	struct dbc_request	*req;
-- 
2.17.1


  parent reply	other threads:[~2020-07-23 14:42 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 14:45 [PATCH 00/27] xhci features for usb-next Mathias Nyman
2020-07-23 14:45 ` [PATCH 01/27] xhci: Make debug message consistent with bus and port number Mathias Nyman
2020-07-23 14:45 ` [PATCH 02/27] xhci: dbc: Don't use generic xhci inc_deq() function for dbc Mathias Nyman
2020-07-23 14:45 ` [PATCH 03/27] xhci: Don't pass struct xhci_hcd pointer to xhci_link_seg() Mathias Nyman
2020-07-23 14:45 ` [PATCH 04/27] xhci: dbc: Don't use generic xhci erst allocation and free functions Mathias Nyman
2020-07-23 14:45 ` [PATCH 05/27] xhci: dbc: Remove dbc_dma_alloc_coherent() wrapper Mathias Nyman
2020-07-23 14:45 ` [PATCH 06/27] xhci: dbc: Remove dbc_dma_free_coherent() wrapper Mathias Nyman
2020-07-23 14:45 ` [PATCH 07/27] xhci: dbc: Add device pointer to dbc structure Mathias Nyman
2020-07-23 14:45 ` [PATCH 08/27] xhci: dbc: Use dev_info() and similar instead of xhci_info() Mathias Nyman
2020-07-23 14:45 ` [PATCH 09/27] xhci: dbc: Don't use xhci_write_64() as it takes xhci as a parameter Mathias Nyman
2020-07-23 14:45 ` [PATCH 10/27] xhci: dbc: Don't pass the xhci pointer as a parameter to xhci_dbc_init_context() Mathias Nyman
2020-07-23 14:45 ` [PATCH 11/27] xhci: dbc: Get the device pointer from dbc structure in dbc_ep_do_queue() Mathias Nyman
2020-07-23 14:45 ` [PATCH 12/27] xhci: dbc: Pass dbc pointer to endpoint init and exit functions Mathias Nyman
2020-07-23 14:45 ` [PATCH 13/27] xhci: dbc: Change to pass dbc pointer to xhci_do_dbc_stop() Mathias Nyman
2020-07-23 14:45 ` [PATCH 14/27] xhci: dbc: Pass dbc pointer to dbc_handle_xfer_event() instead of xhci_hcd pointer Mathias Nyman
2020-07-23 14:45 ` [PATCH 15/27] xhci: dbgtty: Pass dbc pointer when registering a dbctty device Mathias Nyman
2020-07-23 14:45 ` [PATCH 16/27] xhci: dbc: Pass dbc pointer to get_in/out_ep() helper functions to get endpoints Mathias Nyman
2020-07-23 14:45 ` Mathias Nyman [this message]
2020-07-23 14:45 ` [PATCH 18/27] xhci: dbc: Don't use generic xhci context allocation for dbc Mathias Nyman
2020-07-23 14:45 ` [PATCH 19/27] xhci: dbc: don't use generic xhci ring allocation functions " Mathias Nyman
2020-07-23 14:45 ` [PATCH 20/27] xhci: dbc: Pass dbc pointer to dbc memory init and cleanup functions Mathias Nyman
2020-07-23 14:45 ` [PATCH 21/27] xhci: dbc: Pass dbc pointer to dbc start and stop functions Mathias Nyman
2020-07-23 14:45 ` [PATCH 22/27] xhci: dbc: simplify dbc requests allocation and queueing Mathias Nyman
2020-07-23 14:45 ` [PATCH 23/27] xhci: dbc: remove endpoint pointers from dbc_port structure Mathias Nyman
2020-07-23 14:45 ` [PATCH 24/27] xhci: dbctty: split dbc tty driver registration and unregistration functions Mathias Nyman
2020-07-23 14:45 ` [PATCH 25/27] xhci: dbc: Add a operations structure to access driver functions Mathias Nyman
2020-07-23 14:45 ` [PATCH 26/27] xhci: dbgcap: remove dbc dependency on dbctty specific flag Mathias Nyman
2020-07-23 14:45 ` [PATCH 27/27] xhci: dbc: remove tty specific port structure from struct xhci_dbc Mathias Nyman
2020-07-23 15:04 ` [PATCH 00/27] xhci features for usb-next Greg KH
2020-07-23 18:47   ` Mathias Nyman
2020-07-24  7:06     ` Greg KH
2020-07-24 11:11       ` Mathias Nyman
2020-07-24 16:32         ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200723144530.9992-18-mathias.nyman@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.