diff options
| author | Luis Chamberlain <mcgrof@kernel.org> | 2019-01-04 03:23:09 -0500 | 
|---|---|---|
| committer | Christoph Hellwig <hch@lst.de> | 2019-01-08 07:58:37 -0500 | 
| commit | 750afb08ca71310fcf0c4e2cb1565c63b8235b60 (patch) | |
| tree | 1dde3877eb4a1a0f0349786b66c3d9276ae94561 /drivers/usb | |
| parent | 3bd6e94bec122a951d462c239b47954cf5f36e33 (diff) | |
cross-tree: phase out dma_zalloc_coherent()
We already need to zero out memory for dma_alloc_coherent(), as such
using dma_zalloc_coherent() is superflous. Phase it out.
This change was generated with the following Coccinelle SmPL patch:
@ replace_dma_zalloc_coherent @
expression dev, size, data, handle, flags;
@@
-dma_zalloc_coherent(dev, size, handle, flags)
+dma_alloc_coherent(dev, size, handle, flags)
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
[hch: re-ran the script on the latest tree]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/usb')
| -rw-r--r-- | drivers/usb/gadget/udc/bdc/bdc_core.c | 13 | ||||
| -rw-r--r-- | drivers/usb/host/uhci-hcd.c | 6 | ||||
| -rw-r--r-- | drivers/usb/host/xhci-mem.c | 8 | 
3 files changed, 13 insertions, 14 deletions
| diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c index 01b44e159623..ccbd1d34eb2a 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_core.c +++ b/drivers/usb/gadget/udc/bdc/bdc_core.c | |||
| @@ -172,8 +172,9 @@ static int scratchpad_setup(struct bdc *bdc) | |||
| 172 | /* Refer to BDC spec, Table 4 for description of SPB */ | 172 | /* Refer to BDC spec, Table 4 for description of SPB */ | 
| 173 | sp_buff_size = 1 << (sp_buff_size + 5); | 173 | sp_buff_size = 1 << (sp_buff_size + 5); | 
| 174 | dev_dbg(bdc->dev, "Allocating %d bytes for scratchpad\n", sp_buff_size); | 174 | dev_dbg(bdc->dev, "Allocating %d bytes for scratchpad\n", sp_buff_size); | 
| 175 | bdc->scratchpad.buff = dma_zalloc_coherent(bdc->dev, sp_buff_size, | 175 | bdc->scratchpad.buff = dma_alloc_coherent(bdc->dev, sp_buff_size, | 
| 176 | &bdc->scratchpad.sp_dma, GFP_KERNEL); | 176 | &bdc->scratchpad.sp_dma, | 
| 177 | GFP_KERNEL); | ||
| 177 | 178 | ||
| 178 | if (!bdc->scratchpad.buff) | 179 | if (!bdc->scratchpad.buff) | 
| 179 | goto fail; | 180 | goto fail; | 
| @@ -202,11 +203,9 @@ static int setup_srr(struct bdc *bdc, int interrupter) | |||
| 202 | bdc_writel(bdc->regs, BDC_SRRINT(0), BDC_SRR_RWS | BDC_SRR_RST); | 203 | bdc_writel(bdc->regs, BDC_SRRINT(0), BDC_SRR_RWS | BDC_SRR_RST); | 
| 203 | bdc->srr.dqp_index = 0; | 204 | bdc->srr.dqp_index = 0; | 
| 204 | /* allocate the status report descriptors */ | 205 | /* allocate the status report descriptors */ | 
| 205 | bdc->srr.sr_bds = dma_zalloc_coherent( | 206 | bdc->srr.sr_bds = dma_alloc_coherent(bdc->dev, | 
| 206 | bdc->dev, | 207 | NUM_SR_ENTRIES * sizeof(struct bdc_bd), | 
| 207 | NUM_SR_ENTRIES * sizeof(struct bdc_bd), | 208 | &bdc->srr.dma_addr, GFP_KERNEL); | 
| 208 | &bdc->srr.dma_addr, | ||
| 209 | GFP_KERNEL); | ||
| 210 | if (!bdc->srr.sr_bds) | 209 | if (!bdc->srr.sr_bds) | 
| 211 | return -ENOMEM; | 210 | return -ENOMEM; | 
| 212 | 211 | ||
| diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 6218bfe54f52..98deb5f64268 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
| @@ -596,9 +596,9 @@ static int uhci_start(struct usb_hcd *hcd) | |||
| 596 | &uhci_debug_operations); | 596 | &uhci_debug_operations); | 
| 597 | #endif | 597 | #endif | 
| 598 | 598 | ||
| 599 | uhci->frame = dma_zalloc_coherent(uhci_dev(uhci), | 599 | uhci->frame = dma_alloc_coherent(uhci_dev(uhci), | 
| 600 | UHCI_NUMFRAMES * sizeof(*uhci->frame), | 600 | UHCI_NUMFRAMES * sizeof(*uhci->frame), | 
| 601 | &uhci->frame_dma_handle, GFP_KERNEL); | 601 | &uhci->frame_dma_handle, GFP_KERNEL); | 
| 602 | if (!uhci->frame) { | 602 | if (!uhci->frame) { | 
| 603 | dev_err(uhci_dev(uhci), | 603 | dev_err(uhci_dev(uhci), | 
| 604 | "unable to allocate consistent memory for frame list\n"); | 604 | "unable to allocate consistent memory for frame list\n"); | 
| diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 36a3eb8849f1..8067f178fa84 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
| @@ -1672,8 +1672,8 @@ static int scratchpad_alloc(struct xhci_hcd *xhci, gfp_t flags) | |||
| 1672 | xhci->dcbaa->dev_context_ptrs[0] = cpu_to_le64(xhci->scratchpad->sp_dma); | 1672 | xhci->dcbaa->dev_context_ptrs[0] = cpu_to_le64(xhci->scratchpad->sp_dma); | 
| 1673 | for (i = 0; i < num_sp; i++) { | 1673 | for (i = 0; i < num_sp; i++) { | 
| 1674 | dma_addr_t dma; | 1674 | dma_addr_t dma; | 
| 1675 | void *buf = dma_zalloc_coherent(dev, xhci->page_size, &dma, | 1675 | void *buf = dma_alloc_coherent(dev, xhci->page_size, &dma, | 
| 1676 | flags); | 1676 | flags); | 
| 1677 | if (!buf) | 1677 | if (!buf) | 
| 1678 | goto fail_sp4; | 1678 | goto fail_sp4; | 
| 1679 | 1679 | ||
| @@ -1799,8 +1799,8 @@ int xhci_alloc_erst(struct xhci_hcd *xhci, | |||
| 1799 | struct xhci_erst_entry *entry; | 1799 | struct xhci_erst_entry *entry; | 
| 1800 | 1800 | ||
| 1801 | size = sizeof(struct xhci_erst_entry) * evt_ring->num_segs; | 1801 | size = sizeof(struct xhci_erst_entry) * evt_ring->num_segs; | 
| 1802 | erst->entries = dma_zalloc_coherent(xhci_to_hcd(xhci)->self.sysdev, | 1802 | erst->entries = dma_alloc_coherent(xhci_to_hcd(xhci)->self.sysdev, | 
| 1803 | size, &erst->erst_dma_addr, flags); | 1803 | size, &erst->erst_dma_addr, flags); | 
| 1804 | if (!erst->entries) | 1804 | if (!erst->entries) | 
| 1805 | return -ENOMEM; | 1805 | return -ENOMEM; | 
| 1806 | 1806 | ||
