Hi, Thanks for the comment. Since I got a below mentioned error while using just u_audio.c and f_audio.c, I thought to attach audio.c In file included from drivers/usb/gadget/webcam.c:39: drivers/usb/gadget/f_audio.c:227: error: ‘DRIVER_DESC’ undeclared here (not in a function) I also did not want to touch *audio* files. But, I think you are right and we may need a little modification in existing gadget audio (audio.c) driver. The patch, howsoever, is not harmful and okay for me if it is applied or not. ________________________________________ From: linux-usb-owner@xxxxxxxxxxxxxxx [linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of Laurent Pinchart [laurent.pinchart@xxxxxxxxxxxxxxxx] Sent: Wednesday, March 17, 2010 2:32 PM To: Viral Mehta Cc: linux-usb@xxxxxxxxxxxxxxx Subject: Re: [RFC][PATCH] avoid multiple inclusions of file in gadget driver Hi Viral, On Tuesday 16 March 2010 11:05:15 Viral Mehta wrote: > Avoid multiple inclusions. > Guard composite.c, config.c, epautoconf.c, > and ubstring.c from being included for multiple times. > > For e.g., > g_audio driver already includes these files More specifically, audio.c does. > g_video gadget driver which may be used for Video > surveillance will also include them > > Now, if g_webcam is a simple union of g_audio and g_video, > it will get a compilation error for redefinition of symbols without this > patch. Your gadget driver should include one or more functions. It must not include other gadget drivers. The proper way to solve this is to use u_audio.c and f_audio.c in your gadget driver, not audio.c. > > Signed-off-by: Viral Mehta <viral.mehta@xxxxxxxxxxxxxxx> > --- > > diff -Nurp linux-2.6.34-rc1.org/drivers/usb/gadget/composite.c > linux-2.6.34-rc1/drivers/usb/gadget/composite.c --- > linux-2.6.34-rc1.org/drivers/usb/gadget/composite.c 2010-03-16 > 14:04:31.000000000 -0400 +++ > linux-2.6.34-rc1/drivers/usb/gadget/composite.c 2010-03-16 > 14:07:09.000000000 -0400 @@ -18,6 +18,9 @@ > * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 > USA */ > > +#ifndef __COMPOSITE__C > +#define __COMPOSITE__C > + > /* #define VERBOSE_DEBUG */ > > #include <linux/kallsyms.h> > @@ -1148,3 +1151,5 @@ void /* __exit */ usb_composite_unregist > return; > usb_gadget_unregister_driver(&composite_driver); > } > + > +#endif /* __COMPOSITE__C */ > diff -Nurp linux-2.6.34-rc1.org/drivers/usb/gadget/config.c > linux-2.6.34-rc1/drivers/usb/gadget/config.c --- > linux-2.6.34-rc1.org/drivers/usb/gadget/config.c 2010-03-16 > 14:04:31.000000000 -0400 +++ linux-2.6.34-rc1/drivers/usb/gadget/config.c > 2010-03-16 14:07:09.000000000 -0400 @@ -18,6 +18,9 @@ > * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 > USA */ > > +#ifndef __CONFIG_C > +#define __CONFIG_C > + > #include <linux/errno.h> > #include <linux/kernel.h> > #include <linux/list.h> > @@ -189,3 +192,5 @@ usb_find_endpoint( > } > return NULL; > } > + > +#endif /* __CONFIG_C */ > diff -Nurp linux-2.6.34-rc1.org/drivers/usb/gadget/epautoconf.c > linux-2.6.34-rc1/drivers/usb/gadget/epautoconf.c --- > linux-2.6.34-rc1.org/drivers/usb/gadget/epautoconf.c 2010-03-16 > 14:04:31.000000000 -0400 +++ > linux-2.6.34-rc1/drivers/usb/gadget/epautoconf.c 2010-03-16 > 14:07:09.000000000 -0400 @@ -19,6 +19,9 @@ > * > */ > > +#ifndef __EPAUTOCONF_C > +#define __EPAUTOCONF_C > + > #include <linux/kernel.h> > #include <linux/init.h> > #include <linux/types.h> > @@ -317,3 +320,4 @@ void __init usb_ep_autoconfig_reset (str > epnum = 0; > } > > +#endif /* __EPAUTOCONF_C */ > diff -Nurp linux-2.6.34-rc1.org/drivers/usb/gadget/usbstring.c > linux-2.6.34-rc1/drivers/usb/gadget/usbstring.c --- > linux-2.6.34-rc1.org/drivers/usb/gadget/usbstring.c 2010-03-16 > 14:04:31.000000000 -0400 +++ > linux-2.6.34-rc1/drivers/usb/gadget/usbstring.c 2010-03-16 > 14:07:09.000000000 -0400 @@ -7,6 +7,9 @@ > * (at your option) any later version. > */ > > +#ifndef __USBSTRING_C > +#define __USBSTRING_C > + > #include <linux/errno.h> > #include <linux/kernel.h> > #include <linux/list.h> > @@ -134,3 +137,4 @@ usb_gadget_get_string (struct usb_gadget > return buf [0]; > } > > +#endif /* __USBSTRING_C */ -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html ______________________________________________________________________ Thanks, Viral Mehta This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system. ______________________________________________________________________ -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html