[PATCH] avoid multiple inclusions of file in gadget driver

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

 



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;
g_video gadget driver which can also include them separately.

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.

Signed-off-by: Viral Mehta <viral.mehta@xxxxxxxxxxxxxxx>
---
This is against 2.6.34-rc1
Let me know in case if any error while applying, I will resend.

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 */
--

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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux