Commit 314eaf7d authored by Peter Chen's avatar Peter Chen Committed by Greg Kroah-Hartman

usb: host: xhci: delete sp_dma_buffers for scratchpad

We already have sp_array to store each scratch buffer address for xHC,
it doesn't need another sp_dma_buffers array to store it.
Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 724e882d
...@@ -1721,36 +1721,27 @@ static int scratchpad_alloc(struct xhci_hcd *xhci, gfp_t flags) ...@@ -1721,36 +1721,27 @@ static int scratchpad_alloc(struct xhci_hcd *xhci, gfp_t flags)
if (!xhci->scratchpad->sp_buffers) if (!xhci->scratchpad->sp_buffers)
goto fail_sp3; goto fail_sp3;
xhci->scratchpad->sp_dma_buffers =
kzalloc(sizeof(dma_addr_t) * num_sp, flags);
if (!xhci->scratchpad->sp_dma_buffers)
goto fail_sp4;
xhci->dcbaa->dev_context_ptrs[0] = cpu_to_le64(xhci->scratchpad->sp_dma); xhci->dcbaa->dev_context_ptrs[0] = cpu_to_le64(xhci->scratchpad->sp_dma);
for (i = 0; i < num_sp; i++) { for (i = 0; i < num_sp; i++) {
dma_addr_t dma; dma_addr_t dma;
void *buf = dma_alloc_coherent(dev, xhci->page_size, &dma, void *buf = dma_alloc_coherent(dev, xhci->page_size, &dma,
flags); flags);
if (!buf) if (!buf)
goto fail_sp5; goto fail_sp4;
xhci->scratchpad->sp_array[i] = dma; xhci->scratchpad->sp_array[i] = dma;
xhci->scratchpad->sp_buffers[i] = buf; xhci->scratchpad->sp_buffers[i] = buf;
xhci->scratchpad->sp_dma_buffers[i] = dma;
} }
return 0; return 0;
fail_sp5: fail_sp4:
for (i = i - 1; i >= 0; i--) { for (i = i - 1; i >= 0; i--) {
dma_free_coherent(dev, xhci->page_size, dma_free_coherent(dev, xhci->page_size,
xhci->scratchpad->sp_buffers[i], xhci->scratchpad->sp_buffers[i],
xhci->scratchpad->sp_dma_buffers[i]); xhci->scratchpad->sp_array[i]);
} }
kfree(xhci->scratchpad->sp_dma_buffers);
fail_sp4:
kfree(xhci->scratchpad->sp_buffers); kfree(xhci->scratchpad->sp_buffers);
fail_sp3: fail_sp3:
...@@ -1780,9 +1771,8 @@ static void scratchpad_free(struct xhci_hcd *xhci) ...@@ -1780,9 +1771,8 @@ static void scratchpad_free(struct xhci_hcd *xhci)
for (i = 0; i < num_sp; i++) { for (i = 0; i < num_sp; i++) {
dma_free_coherent(dev, xhci->page_size, dma_free_coherent(dev, xhci->page_size,
xhci->scratchpad->sp_buffers[i], xhci->scratchpad->sp_buffers[i],
xhci->scratchpad->sp_dma_buffers[i]); xhci->scratchpad->sp_array[i]);
} }
kfree(xhci->scratchpad->sp_dma_buffers);
kfree(xhci->scratchpad->sp_buffers); kfree(xhci->scratchpad->sp_buffers);
dma_free_coherent(dev, num_sp * sizeof(u64), dma_free_coherent(dev, num_sp * sizeof(u64),
xhci->scratchpad->sp_array, xhci->scratchpad->sp_array,
......
...@@ -1606,7 +1606,6 @@ struct xhci_scratchpad { ...@@ -1606,7 +1606,6 @@ struct xhci_scratchpad {
u64 *sp_array; u64 *sp_array;
dma_addr_t sp_dma; dma_addr_t sp_dma;
void **sp_buffers; void **sp_buffers;
dma_addr_t *sp_dma_buffers;
}; };
struct urb_priv { struct urb_priv {
......
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