All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC] usb: gadget: CONFIG_USB_S3C_HSOTG should depend on HAS_DMA
@ 2014-05-06 12:49 Geert Uytterhoeven
  2014-05-06 13:17 ` David Laight
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2014-05-06 12:49 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Ben Dooks
  Cc: linux-usb, linux-kernel, Geert Uytterhoeven

If NO_DMA=y:

drivers/built-in.o: In function `s3c_hsotg_map_dma':
s3c-hsotg.c:(.text+0x375b2c): undefined reference to `usb_gadget_map_request'
drivers/built-in.o: In function `s3c_hsotg_unmap_dma':
s3c-hsotg.c:(.text+0x376a32): undefined reference to `usb_gadget_unmap_request'
make[3]: *** [vmlinux] Error 1

Note that all callers of s3c_hsotg_map_dma()/s3c_hsotg_unmap_dma() are
protected by a call into the using_dma() checking function:

static inline bool using_dma(struct s3c_hsotg *hsotg)
{
        return false;   /* support is not complete */
}

but not all versions of gcc manage to optimize the check away, causing a
link error.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Perhaps the DMA code should be removed completely, as its unused, or be
protected by #ifdef CONFIG_HAS_DMA instead?

 drivers/usb/gadget/Kconfig |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 3557c7e5040d..0e9dead51a27 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -302,6 +302,7 @@ config USB_PXA27X
 
 config USB_S3C_HSOTG
 	tristate "Designware/S3C HS/OtG USB Device controller"
+	depends on HAS_DMA
 	help
 	  The Designware USB2.0 high-speed gadget controller
 	  integrated into many SoCs.
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH/RFC] usb: gadget: CONFIG_USB_S3C_HSOTG should depend on HAS_DMA
  2014-05-06 12:49 [PATCH/RFC] usb: gadget: CONFIG_USB_S3C_HSOTG should depend on HAS_DMA Geert Uytterhoeven
@ 2014-05-06 13:17 ` David Laight
  2014-05-06 15:02   ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: David Laight @ 2014-05-06 13:17 UTC (permalink / raw)
  To: 'Geert Uytterhoeven',
	Felipe Balbi, Greg Kroah-Hartman, Ben Dooks
  Cc: linux-usb, linux-kernel

From: Geert Uytterhoeven
> If NO_DMA=y:
> 
> drivers/built-in.o: In function `s3c_hsotg_map_dma':
> s3c-hsotg.c:(.text+0x375b2c): undefined reference to `usb_gadget_map_request'
> drivers/built-in.o: In function `s3c_hsotg_unmap_dma':
> s3c-hsotg.c:(.text+0x376a32): undefined reference to `usb_gadget_unmap_request'
> make[3]: *** [vmlinux] Error 1
> 
> Note that all callers of s3c_hsotg_map_dma()/s3c_hsotg_unmap_dma() are
> protected by a call into the using_dma() checking function:
> 
> static inline bool using_dma(struct s3c_hsotg *hsotg)
> {
>         return false;   /* support is not complete */
> }
> 
> but not all versions of gcc manage to optimize the check away, causing a
> link error.

A have seen gcc optimise away a call, but leave the undefined symbol
in the symbol table.
That might be what is happening here.

I don't know a generic solution, I used 'objcopy -N__udivdi3' to remove
the explicit unwanted reference from my driver.

	David




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH/RFC] usb: gadget: CONFIG_USB_S3C_HSOTG should depend on HAS_DMA
  2014-05-06 13:17 ` David Laight
@ 2014-05-06 15:02   ` Geert Uytterhoeven
  0 siblings, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2014-05-06 15:02 UTC (permalink / raw)
  To: David Laight
  Cc: Felipe Balbi, Greg Kroah-Hartman, Ben Dooks, linux-usb, linux-kernel

Hi David,

On Tue, May 6, 2014 at 3:17 PM, David Laight <David.Laight@aculab.com> wrote:
>> If NO_DMA=y:
>>
>> drivers/built-in.o: In function `s3c_hsotg_map_dma':
>> s3c-hsotg.c:(.text+0x375b2c): undefined reference to `usb_gadget_map_request'
>> drivers/built-in.o: In function `s3c_hsotg_unmap_dma':
>> s3c-hsotg.c:(.text+0x376a32): undefined reference to `usb_gadget_unmap_request'
>> make[3]: *** [vmlinux] Error 1
>>
>> Note that all callers of s3c_hsotg_map_dma()/s3c_hsotg_unmap_dma() are
>> protected by a call into the using_dma() checking function:
>>
>> static inline bool using_dma(struct s3c_hsotg *hsotg)
>> {
>>         return false;   /* support is not complete */
>> }
>>
>> but not all versions of gcc manage to optimize the check away, causing a
>> link error.
>
> A have seen gcc optimise away a call, but leave the undefined symbol
> in the symbol table.
> That might be what is happening here.

Indeed, the unused functions s3c_hsotg_{,un}map_dma() are still there,
but the calls to them have been optimized away.

Marking s3c_hsotg_{,un}map_dma() inline fixes that. I'll send a new patch
doing that, as it's a bit silly to require "depends on HAS_DMA" for a driver
which has DMA disabled.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-06 15:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-06 12:49 [PATCH/RFC] usb: gadget: CONFIG_USB_S3C_HSOTG should depend on HAS_DMA Geert Uytterhoeven
2014-05-06 13:17 ` David Laight
2014-05-06 15:02   ` Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.