Commit 908b9613 authored by Alan Stern's avatar Alan Stern Committed by Felipe Balbi

usb: gadget: don't fail when DMA isn't present

When CONFIG_HAS_DMA isn't enabled, the UDC core gets build errors:

drivers/built-in.o: In function `dma_set_coherent_mask':
include/linux/dma-mapping.h:93: undefined reference to `dma_supported'
include/linux/dma-mapping.h:93: undefined reference to `dma_supported'
drivers/built-in.o: In function `usb_gadget_unmap_request':
drivers/usb/gadget/udc-core.c:91: undefined reference to `dma_unmap_sg'
drivers/usb/gadget/udc-core.c:96: undefined reference to `dma_unmap_single'
drivers/built-in.o: In function `usb_gadget_map_request':
drivers/usb/gadget/udc-core.c:62: undefined reference to `dma_map_sg'
drivers/usb/gadget/udc-core.c:71: undefined reference to `dma_map_single'
drivers/usb/gadget/udc-core.c:74: undefined reference to `dma_mapping_error'

Prevent this by protecting the DMA API routines with preprocessor tests.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
CC: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 91f6b847
...@@ -50,6 +50,8 @@ static DEFINE_MUTEX(udc_lock); ...@@ -50,6 +50,8 @@ static DEFINE_MUTEX(udc_lock);
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
#ifdef CONFIG_HAS_DMA
int usb_gadget_map_request(struct usb_gadget *gadget, int usb_gadget_map_request(struct usb_gadget *gadget,
struct usb_request *req, int is_in) struct usb_request *req, int is_in)
{ {
...@@ -99,6 +101,8 @@ void usb_gadget_unmap_request(struct usb_gadget *gadget, ...@@ -99,6 +101,8 @@ void usb_gadget_unmap_request(struct usb_gadget *gadget,
} }
EXPORT_SYMBOL_GPL(usb_gadget_unmap_request); EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);
#endif /* CONFIG_HAS_DMA */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
void usb_gadget_set_state(struct usb_gadget *gadget, void usb_gadget_set_state(struct usb_gadget *gadget,
...@@ -194,9 +198,11 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget, ...@@ -194,9 +198,11 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
dev_set_name(&gadget->dev, "gadget"); dev_set_name(&gadget->dev, "gadget");
gadget->dev.parent = parent; gadget->dev.parent = parent;
#ifdef CONFIG_HAS_DMA
dma_set_coherent_mask(&gadget->dev, parent->coherent_dma_mask); dma_set_coherent_mask(&gadget->dev, parent->coherent_dma_mask);
gadget->dev.dma_parms = parent->dma_parms; gadget->dev.dma_parms = parent->dma_parms;
gadget->dev.dma_mask = parent->dma_mask; gadget->dev.dma_mask = parent->dma_mask;
#endif
if (release) if (release)
gadget->dev.release = release; gadget->dev.release = release;
......
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