Re: [PATCH] avoid multiple inclusions of file in gadget driver

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

 



Hello.

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

  Why double underscore before C in this file but not in other files?

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

WBR, Sergei

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