Re: [PATCH v2 1/2] ARM : OMAP : Add empty functions in header file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 04, 2010 at 06:18:08PM +0530, Maulik wrote:
> 
> >>not omap-specific. How about USB: instead ?
> 
> [Maulik] Yes this can go through linux-usb.
> 
> > +#if defined(CONFIG_USB_NOP_XCEIV)
> >  /* sometimes transceivers are accessed only through e.g. ULPI */
> >  extern void usb_nop_xceiv_register(void);
> >  extern void usb_nop_xceiv_unregister(void);
> > +#else
> > +extern inline void usb_nop_xceiv_register()
> > +{
> > +}
> > +
> > +extern inline void usb_nop_xceiv_unregister()
> 
> >>I hope these are copy&paste error
> 
> [Maulik] Nope. When 'extern' is dropped I get the following error while
> compiling when CONFIG_USB_NOP_XCEIV is NOT defined. 
> 
> arch/arm/plat-omap/built-in.o: In function `usb_nop_xceiv_unregister':
> /share/maulik/felipe_musb/include/linux/usb/otg.h:123: multiple definition
> of `usb_nop_xceiv_unregister'
> arch/arm/mach-omap2/built-in.o:/share/maulik/felipe_musb/include/linux/usb/o
> tg.h:123: first defined here
> arch/arm/plat-omap/built-in.o: In function `usb_nop_xceiv_register':
> /share/maulik/felipe_musb/include/linux/usb/otg.h:119: multiple definition
> of `usb_nop_xceiv_register'
> arch/arm/mach-omap2/built-in.o:/share/maulik/felipe_musb/include/linux/usb/o
> tg.h:119: first defined here
> make: *** [vmlinux.o] Error 1
> 
> I referred some kernel code which uses extern inline. 
> 
> Any suggestions?

It needs to be static inline:

#ifdef CONFIG_USB_NO_XCEIV
/* sometimes transceivers are accessed only through e.g. ULPI */
extern void usb_nop_xceiv_register(void);
extern void usb_nop_xceiv_unregister(void);
#else
static inline void usb_nop_xceiv_register(void) { }
static inline void usb_nop_xceiv_unregister(void) { }
#endif

And you need to make sure that the actual body of the function in the
C file is encapsulated with #ifdef too, since the very point of having
it under a config option is to not include it if it's not selected
and needed.

-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux