Blob Blame History Raw
From dd98570be1fb3bec14c2347edf4a499aaf7870de Mon Sep 17 00:00:00 2001
From: Mathias Nyman <mathias.nyman@linux.intel.com>
Date: Thu, 23 Jul 2020 17:45:23 +0300
Subject: [PATCH] xhci: dbc: Pass dbc pointer to dbc memory init and cleanup
 functions
Git-commit: dd98570be1fb3bec14c2347edf4a499aaf7870de
References: jsc#SLE-14911
Patch-mainline: v5.9-rc1

Dbc mem_init and mem_cleanup functions used xhci_hcd to get to the device
pointer. The device pointer can be accessed directly from dbc structure,
so pass a pointer to dbc as a parameter 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-21-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/usb/host/xhci-dbgcap.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c
index b00cbff5e2ca..626635f26658 100644
--- a/drivers/usb/host/xhci-dbgcap.c
+++ b/drivers/usb/host/xhci-dbgcap.c
@@ -451,13 +451,12 @@ xhci_dbc_ring_alloc(struct device *dev, enum xhci_ring_type type, gfp_t flags)
 	return NULL;
 }
 
-static int xhci_dbc_mem_init(struct xhci_hcd *xhci, gfp_t flags)
+static int xhci_dbc_mem_init(struct xhci_dbc *dbc, gfp_t flags)
 {
 	int			ret;
 	dma_addr_t		deq;
 	u32			string_length;
-	struct xhci_dbc		*dbc = xhci->dbc;
-	struct device		*dev = xhci_to_hcd(xhci)->self.controller;
+	struct device		*dev = dbc->dev;
 
 	/* Allocate various rings for events and transfers: */
 	dbc->ring_evt = xhci_dbc_ring_alloc(dev, TYPE_EVENT, flags);
@@ -524,11 +523,8 @@ static int xhci_dbc_mem_init(struct xhci_hcd *xhci, gfp_t flags)
 	return -ENOMEM;
 }
 
-static void xhci_dbc_mem_cleanup(struct xhci_hcd *xhci)
+static void xhci_dbc_mem_cleanup(struct xhci_dbc *dbc)
 {
-	struct xhci_dbc		*dbc = xhci->dbc;
-	struct device		*dev = xhci_to_hcd(xhci)->self.controller;
-
 	if (!dbc)
 		return;
 
@@ -568,7 +564,7 @@ static int xhci_do_dbc_start(struct xhci_hcd *xhci)
 	if (ret)
 		return ret;
 
-	ret = xhci_dbc_mem_init(xhci, GFP_ATOMIC);
+	ret = xhci_dbc_mem_init(dbc, GFP_ATOMIC);
 	if (ret)
 		return ret;
 
@@ -638,7 +634,7 @@ static void xhci_dbc_stop(struct xhci_hcd *xhci)
 	spin_unlock_irqrestore(&dbc->lock, flags);
 
 	if (!ret) {
-		xhci_dbc_mem_cleanup(xhci);
+		xhci_dbc_mem_cleanup(dbc);
 		pm_runtime_put_sync(xhci_to_hcd(xhci)->self.controller);
 	}
 }
-- 
2.26.2