public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] ARM : OMAP : Add empty functions in header file
@ 2010-01-04 11:09 Maulik Mankad
       [not found] ` <1262603399-13036-1-git-send-email-x0082077-l0cyMroinI0@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Maulik Mankad @ 2010-01-04 11:09 UTC (permalink / raw)
  To: linux-omap
  Cc: linux-usb, Maulik Mankad, Tony Lindgren, Felipe Balbi,
	Greg Kroah-Hartman, Olof Johansson, Sergei Shtylyov,
	Gupta, Ajay Kumar

ARM : OMAP : Add empty functions in header file

Add empty functions for usb_nop_xceiv_register()
and usb_nop_xceiv_unregister() so that these functions
can be called even when CONFIG_NOP_USB_XCEIV is not 
enabled. 

It allows to remove ifdef's from board file.

Signed-off-by: Maulik Mankad <x0082077@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Felipe Balbi <felipe.balbi@nokia.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Olof Johansson <olof@lixom.net>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Gupta, Ajay Kumar <ajay.gupta@ti.com>
---
Index: felipe_musb/include/linux/usb/otg.h
===================================================================
--- felipe_musb.orig/include/linux/usb/otg.h
+++ felipe_musb/include/linux/usb/otg.h
@@ -110,9 +110,19 @@ struct otg_transceiver {
 /* for board-specific init logic */
 extern int otg_set_transceiver(struct otg_transceiver *);
 
+#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()
+{
+}
+#endif
 
 /* helpers for direct access thru low-level io interface */
 static inline int otg_io_read(struct otg_transceiver *otg, u32 reg)

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

* RE: [PATCH v2 1/2] ARM : OMAP : Add empty functions in header file
       [not found] ` <1262603399-13036-1-git-send-email-x0082077-l0cyMroinI0@public.gmane.org>
@ 2010-01-04 12:29   ` Gupta, Ajay Kumar
  2010-01-04 12:34   ` Felipe Balbi
  1 sibling, 0 replies; 6+ messages in thread
From: Gupta, Ajay Kumar @ 2010-01-04 12:29 UTC (permalink / raw)
  To: Mankad, Maulik Ojas,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Tony Lindgren,
	Felipe Balbi, Greg Kroah-Hartman, Olof Johansson, Sergei Shtylyov

> -----Original Message-----
> From: Mankad, Maulik Ojas
> Sent: Monday, January 04, 2010 4:40 PM
> To: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Mankad, Maulik Ojas; Tony Lindgren; Felipe
> Balbi; Greg Kroah-Hartman; Olof Johansson; Sergei Shtylyov; Gupta, Ajay
> Kumar
> Subject: [PATCH v2 1/2] ARM : OMAP : Add empty functions in header file
> 
> ARM : OMAP : Add empty functions in header file
> 
> Add empty functions for usb_nop_xceiv_register()
> and usb_nop_xceiv_unregister() so that these functions
> can be called even when CONFIG_NOP_USB_XCEIV is not
> enabled.
> 
> It allows to remove ifdef's from board file.
> 
> Signed-off-by: Maulik Mankad <x0082077-l0cyMroinI0@public.gmane.org>
> Cc: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
> Cc: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> Cc: Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>
> Cc: Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
> Cc: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
> Cc: Gupta, Ajay Kumar <ajay.gupta-l0cyMroinI0@public.gmane.org>
> ---
> Index: felipe_musb/include/linux/usb/otg.h
> ===================================================================
> --- felipe_musb.orig/include/linux/usb/otg.h
> +++ felipe_musb/include/linux/usb/otg.h
> @@ -110,9 +110,19 @@ struct otg_transceiver {
>  /* for board-specific init logic */
>  extern int otg_set_transceiver(struct otg_transceiver *);
> 
> +#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()
   ^^^^^^

'extern' should not be used here.

-Ajay
> +#endif
> 
>  /* helpers for direct access thru low-level io interface */
>  static inline int otg_io_read(struct otg_transceiver *otg, u32 reg)
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 1/2] ARM : OMAP : Add empty functions in header file
       [not found] ` <1262603399-13036-1-git-send-email-x0082077-l0cyMroinI0@public.gmane.org>
  2010-01-04 12:29   ` Gupta, Ajay Kumar
@ 2010-01-04 12:34   ` Felipe Balbi
  2010-01-04 12:48     ` Maulik
  1 sibling, 1 reply; 6+ messages in thread
From: Felipe Balbi @ 2010-01-04 12:34 UTC (permalink / raw)
  To: Maulik Mankad
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren, Felipe Balbi,
	Greg Kroah-Hartman, Olof Johansson, Sergei Shtylyov,
	Gupta, Ajay Kumar

Hi,

On Mon, Jan 04, 2010 at 04:39:59PM +0530, Maulik Mankad wrote:
> ARM : OMAP : Add empty functions in header file

not omap-specific. How about USB: instead ?

> +#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

-- 
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH v2 1/2] ARM : OMAP : Add empty functions in header file
  2010-01-04 12:34   ` Felipe Balbi
@ 2010-01-04 12:48     ` Maulik
       [not found]       ` <016301ca8d3c$2d2b7f60$808918ac-wD+IZp/g4/2mHdYHvhjUOg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Maulik @ 2010-01-04 12:48 UTC (permalink / raw)
  To: me
  Cc: linux-omap, linux-usb, 'Tony Lindgren',
	'Felipe Balbi', 'Greg Kroah-Hartman',
	'Olof Johansson', 'Sergei Shtylyov',
	'Gupta, Ajay Kumar'


>>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?

Regards,
Maulik


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

* Re: [PATCH v2 1/2] ARM : OMAP : Add empty functions in header file
       [not found]       ` <016301ca8d3c$2d2b7f60$808918ac-wD+IZp/g4/2mHdYHvhjUOg@public.gmane.org>
@ 2010-01-04 15:25         ` Olof Johansson
  2010-01-05  5:15           ` Maulik
  0 siblings, 1 reply; 6+ messages in thread
From: Olof Johansson @ 2010-01-04 15:25 UTC (permalink / raw)
  To: Maulik
  Cc: me-uiRdBs8odbtmTBlB0Cgj/Q, linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, 'Tony Lindgren',
	'Felipe Balbi', 'Greg Kroah-Hartman',
	'Sergei Shtylyov', 'Gupta, Ajay Kumar'

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-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH v2 1/2] ARM : OMAP : Add empty functions in header file
  2010-01-04 15:25         ` Olof Johansson
@ 2010-01-05  5:15           ` Maulik
  0 siblings, 0 replies; 6+ messages in thread
From: Maulik @ 2010-01-05  5:15 UTC (permalink / raw)
  To: 'Olof Johansson'
  Cc: me, linux-omap, linux-usb, 'Tony Lindgren',
	'Felipe Balbi', 'Greg Kroah-Hartman',
	'Sergei Shtylyov', 'Gupta, Ajay Kumar'


>>It needs to be static inline:

[Maulik] Yes that's true. 

>>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.

[Maulik] The actual body of the function is defined in 
drivers/usb/otg/nop-usb-xceiv.c. This file is compiled only if
CONFIG_NOP_USB_XCEIV option is selected. 

Hence I think we won't need to explicitly protect it with a #ifdef.

I shall post a new version of the patch with the changes.

Regards,
Maulik




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

end of thread, other threads:[~2010-01-05  5:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-04 11:09 [PATCH v2 1/2] ARM : OMAP : Add empty functions in header file Maulik Mankad
     [not found] ` <1262603399-13036-1-git-send-email-x0082077-l0cyMroinI0@public.gmane.org>
2010-01-04 12:29   ` Gupta, Ajay Kumar
2010-01-04 12:34   ` Felipe Balbi
2010-01-04 12:48     ` Maulik
     [not found]       ` <016301ca8d3c$2d2b7f60$808918ac-wD+IZp/g4/2mHdYHvhjUOg@public.gmane.org>
2010-01-04 15:25         ` Olof Johansson
2010-01-05  5:15           ` Maulik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox