mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-25 10:59:05 +00:00
xhci: remove conversion from generic to pci device in xhci_mem.c
This patch removes the to_pci_dev() conversion performed to generic struct device since it is not actually useful (the pointer to the generic device can be used directly rather through a conversion to pci_dev) and it is pci bus specific. This isn't stable material because this code will produce harmless behavior on non-PCI xHCI hosts. The pci_device pointer is never dereferenced, only used to re-calculate the underlying device pointer. Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
This commit is contained in:
parent
78d1ff0256
commit
2a10004748
@ -433,10 +433,10 @@ static void xhci_free_stream_ctx(struct xhci_hcd *xhci,
|
||||
unsigned int num_stream_ctxs,
|
||||
struct xhci_stream_ctx *stream_ctx, dma_addr_t dma)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller);
|
||||
struct device *dev = xhci_to_hcd(xhci)->self.controller;
|
||||
|
||||
if (num_stream_ctxs > MEDIUM_STREAM_ARRAY_SIZE)
|
||||
dma_free_coherent(&pdev->dev,
|
||||
dma_free_coherent(dev,
|
||||
sizeof(struct xhci_stream_ctx)*num_stream_ctxs,
|
||||
stream_ctx, dma);
|
||||
else if (num_stream_ctxs <= SMALL_STREAM_ARRAY_SIZE)
|
||||
@ -461,10 +461,10 @@ static struct xhci_stream_ctx *xhci_alloc_stream_ctx(struct xhci_hcd *xhci,
|
||||
unsigned int num_stream_ctxs, dma_addr_t *dma,
|
||||
gfp_t mem_flags)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller);
|
||||
struct device *dev = xhci_to_hcd(xhci)->self.controller;
|
||||
|
||||
if (num_stream_ctxs > MEDIUM_STREAM_ARRAY_SIZE)
|
||||
return dma_alloc_coherent(&pdev->dev,
|
||||
return dma_alloc_coherent(dev,
|
||||
sizeof(struct xhci_stream_ctx)*num_stream_ctxs,
|
||||
dma, mem_flags);
|
||||
else if (num_stream_ctxs <= SMALL_STREAM_ARRAY_SIZE)
|
||||
@ -1616,7 +1616,7 @@ static void scratchpad_free(struct xhci_hcd *xhci)
|
||||
{
|
||||
int num_sp;
|
||||
int i;
|
||||
struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller);
|
||||
struct device *dev = xhci_to_hcd(xhci)->self.controller;
|
||||
|
||||
if (!xhci->scratchpad)
|
||||
return;
|
||||
@ -1624,13 +1624,13 @@ static void scratchpad_free(struct xhci_hcd *xhci)
|
||||
num_sp = HCS_MAX_SCRATCHPAD(xhci->hcs_params2);
|
||||
|
||||
for (i = 0; i < num_sp; i++) {
|
||||
dma_free_coherent(&pdev->dev, xhci->page_size,
|
||||
dma_free_coherent(dev, xhci->page_size,
|
||||
xhci->scratchpad->sp_buffers[i],
|
||||
xhci->scratchpad->sp_dma_buffers[i]);
|
||||
}
|
||||
kfree(xhci->scratchpad->sp_dma_buffers);
|
||||
kfree(xhci->scratchpad->sp_buffers);
|
||||
dma_free_coherent(&pdev->dev, num_sp * sizeof(u64),
|
||||
dma_free_coherent(dev, num_sp * sizeof(u64),
|
||||
xhci->scratchpad->sp_array,
|
||||
xhci->scratchpad->sp_dma);
|
||||
kfree(xhci->scratchpad);
|
||||
@ -1692,7 +1692,7 @@ void xhci_free_command(struct xhci_hcd *xhci,
|
||||
|
||||
void xhci_mem_cleanup(struct xhci_hcd *xhci)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller);
|
||||
struct device *dev = xhci_to_hcd(xhci)->self.controller;
|
||||
struct xhci_cd *cur_cd, *next_cd;
|
||||
int size;
|
||||
int i, j, num_ports;
|
||||
@ -1700,7 +1700,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
|
||||
/* Free the Event Ring Segment Table and the actual Event Ring */
|
||||
size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries);
|
||||
if (xhci->erst.entries)
|
||||
dma_free_coherent(&pdev->dev, size,
|
||||
dma_free_coherent(dev, size,
|
||||
xhci->erst.entries, xhci->erst.erst_dma_addr);
|
||||
xhci->erst.entries = NULL;
|
||||
xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Freed ERST");
|
||||
@ -1748,7 +1748,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
|
||||
"Freed medium stream array pool");
|
||||
|
||||
if (xhci->dcbaa)
|
||||
dma_free_coherent(&pdev->dev, sizeof(*xhci->dcbaa),
|
||||
dma_free_coherent(dev, sizeof(*xhci->dcbaa),
|
||||
xhci->dcbaa, xhci->dcbaa->dma);
|
||||
xhci->dcbaa = NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user