diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2016-02-16 10:10:57 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-02-20 23:22:55 -0500 |
commit | 58f2266f4019b9d023979de31950d34cce23b43c (patch) | |
tree | 0eb8d890ab2985385f5eba7ea21759b54b043503 /drivers/usb/core/buffer.c | |
parent | ef976ea33b4c44d6cd14ee63cb237c6bab40f91b (diff) |
usb: core: Allow compilation on platforms where NO_DMA=y
Some platforms don't have DMA, but we should still be able to build USB
drivers for these platforms. They could still be used through vhci_hcd,
usbip_host, or maybe something like USB passthrough in UML from a
capable host.
If NO_DMA=y:
ERROR: "dma_pool_destroy" [drivers/usb/core/usbcore.ko] undefined!
ERROR: "bad_dma_ops" [drivers/usb/core/usbcore.ko] undefined!
ERROR: "dma_pool_free" [drivers/usb/core/usbcore.ko] undefined!
ERROR: "dma_pool_alloc" [drivers/usb/core/usbcore.ko] undefined!
ERROR: "dma_pool_create" [drivers/usb/core/usbcore.ko] undefined!
Add a few checks for CONFIG_HAS_DMA to fix this.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/buffer.c')
-rw-r--r-- | drivers/usb/core/buffer.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index 89f2e7765093..2741566ee4f2 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c | |||
@@ -62,8 +62,9 @@ int hcd_buffer_create(struct usb_hcd *hcd) | |||
62 | char name[16]; | 62 | char name[16]; |
63 | int i, size; | 63 | int i, size; |
64 | 64 | ||
65 | if (!hcd->self.controller->dma_mask && | 65 | if (!IS_ENABLED(CONFIG_HAS_DMA) || |
66 | !(hcd->driver->flags & HCD_LOCAL_MEM)) | 66 | (!hcd->self.controller->dma_mask && |
67 | !(hcd->driver->flags & HCD_LOCAL_MEM))) | ||
67 | return 0; | 68 | return 0; |
68 | 69 | ||
69 | for (i = 0; i < HCD_BUFFER_POOLS; i++) { | 70 | for (i = 0; i < HCD_BUFFER_POOLS; i++) { |
@@ -93,6 +94,9 @@ void hcd_buffer_destroy(struct usb_hcd *hcd) | |||
93 | { | 94 | { |
94 | int i; | 95 | int i; |
95 | 96 | ||
97 | if (!IS_ENABLED(CONFIG_HAS_DMA)) | ||
98 | return; | ||
99 | |||
96 | for (i = 0; i < HCD_BUFFER_POOLS; i++) { | 100 | for (i = 0; i < HCD_BUFFER_POOLS; i++) { |
97 | struct dma_pool *pool = hcd->pool[i]; | 101 | struct dma_pool *pool = hcd->pool[i]; |
98 | 102 | ||
@@ -119,8 +123,9 @@ void *hcd_buffer_alloc( | |||
119 | int i; | 123 | int i; |
120 | 124 | ||
121 | /* some USB hosts just use PIO */ | 125 | /* some USB hosts just use PIO */ |
122 | if (!bus->controller->dma_mask && | 126 | if (!IS_ENABLED(CONFIG_HAS_DMA) || |
123 | !(hcd->driver->flags & HCD_LOCAL_MEM)) { | 127 | (!bus->controller->dma_mask && |
128 | !(hcd->driver->flags & HCD_LOCAL_MEM))) { | ||
124 | *dma = ~(dma_addr_t) 0; | 129 | *dma = ~(dma_addr_t) 0; |
125 | return kmalloc(size, mem_flags); | 130 | return kmalloc(size, mem_flags); |
126 | } | 131 | } |
@@ -145,8 +150,9 @@ void hcd_buffer_free( | |||
145 | if (!addr) | 150 | if (!addr) |
146 | return; | 151 | return; |
147 | 152 | ||
148 | if (!bus->controller->dma_mask && | 153 | if (!IS_ENABLED(CONFIG_HAS_DMA) || |
149 | !(hcd->driver->flags & HCD_LOCAL_MEM)) { | 154 | (!bus->controller->dma_mask && |
155 | !(hcd->driver->flags & HCD_LOCAL_MEM))) { | ||
150 | kfree(addr); | 156 | kfree(addr); |
151 | return; | 157 | return; |
152 | } | 158 | } |