Re: [PATCH] usb: USB host support should depend on HAS_DMA
From: Arnd Bergmann <arnd@arndb.de>
Date: 2013-07-10 23:13:07
Also in:
linux-media, lkml
From: Arnd Bergmann <arnd@arndb.de>
Date: 2013-07-10 23:13:07
Also in:
linux-media, lkml
On Wednesday 10 July 2013, Alan Stern wrote:
This isn't right. There are USB host controllers that use PIO, not DMA. The HAS_DMA dependency should go with the controller driver, not the USB core. On the other hand, the USB core does call various routines like dma_unmap_single. It ought to be possible to compile these calls even when DMA isn't enabled. That is, they should be defined as do-nothing stubs.
The asm-generic/dma-mapping-broken.h file intentionally causes link
errors, but that could be changed.
The better approach in my mind would be to replace code like
if (hcd->self.uses_dma)
with
if (IS_ENABLED(CONFIG_HAS_DMA) && hcd->self.uses_dma) {
which will reliably cause that reference to be omitted from object code,
but not stop giving link errors for drivers that actually require
DMA.
Arnd