Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756200Ab3GKPDy (ORCPT ); Thu, 11 Jul 2013 11:03:54 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:34143 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751197Ab3GKPDw (ORCPT ); Thu, 11 Jul 2013 11:03:52 -0400 Date: Thu, 11 Jul 2013 11:03:52 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Geert Uytterhoeven cc: Arnd Bergmann , Greg Kroah-Hartman , "linux-input@vger.kernel.org" , Linux Media Mailing List , USB list , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] usb: USB host support should depend on HAS_DMA In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1884 Lines: 51 On Thu, 11 Jul 2013, Geert Uytterhoeven wrote: > On Thu, Jul 11, 2013 at 3:01 AM, Alan Stern wrote: > > On Thu, 11 Jul 2013, Arnd Bergmann wrote: > > > >> 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. > > > > How will it give link errors for drivers that require DMA? > > It won't. Unless the host driver itself calls into the DMA API, too > (are there any that don't?). To my knowledge, all the host controller drivers which use DMA _do_ call functions in the DMA API. So they would still get link errors, even though the USB core wouldn't. Therefore adding the appropriate HAS_DMA dependencies should be straightforward: Try to build all the drivers and see which ones fail to link. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/