[net-next:master 6/12] include/linux/usb/cdc.h:23: error: redefinition of 'struct usb_cdc_parsed_header'

5 messages, 2 authors, 2015-09-16 · open the first message on its own page

[net-next:master 6/12] include/linux/usb/cdc.h:23: error: redefinition of 'struct usb_cdc_parsed_header'

From: kbuild test robot <hidden>
Date: 2015-09-15 19:58:00

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   8b711d6db5c78a6d1969fb0fccb93daa7df53762
commit: c40a2c8817e42273a4627c48c884b805475a733f [6/12] CDC: common parser for extra headers
config: avr32-atngw100_defconfig (attached as .config)
reproduce:
  wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
  chmod +x ~/bin/make.cross
  git checkout c40a2c8817e42273a4627c48c884b805475a733f
  # save the attached .config to linux build tree
  make.cross ARCH=avr32 

All error/warnings (new ones prefixed by >>):

   In file included from drivers/usb/gadget/function/u_ether.h:20,
                    from drivers/usb/gadget/legacy/cdc2.c:16:
   include/linux/usb/cdc.h:47: warning: 'struct usb_interface' declared inside parameter list
   include/linux/usb/cdc.h:47: warning: its scope is only this definition or declaration, which is probably not what you want
   In file included from drivers/usb/gadget/function/u_serial.h:16,
                    from drivers/usb/gadget/legacy/cdc2.c:17:
quoted
include/linux/usb/cdc.h:23: error: redefinition of 'struct usb_cdc_parsed_header'
   include/linux/usb/cdc.h:47: warning: 'struct usb_interface' declared inside parameter list
quoted
include/linux/usb/cdc.h:47: error: conflicting types for 'cdc_parse_cdc_header'
   include/linux/usb/cdc.h:47: error: previous declaration of 'cdc_parse_cdc_header' was here

vim +23 include/linux/usb/cdc.h

    17	#define CDC_PHONET_MAGIC_NUMBER		0xAB
    18	
    19	/*
    20	 * parsing CDC headers
    21	 */
    22	
  > 23	struct usb_cdc_parsed_header {
    24		struct usb_cdc_union_desc *usb_cdc_union_desc;
    25		struct usb_cdc_header_desc *usb_cdc_header_desc;
    26	
    27		struct usb_cdc_call_mgmt_descriptor *usb_cdc_call_mgmt_descriptor;
    28		struct usb_cdc_acm_descriptor *usb_cdc_acm_descriptor;
    29		struct usb_cdc_country_functional_desc *usb_cdc_country_functional_desc;
    30		struct usb_cdc_network_terminal_desc *usb_cdc_network_terminal_desc;
    31		struct usb_cdc_ether_desc *usb_cdc_ether_desc;
    32		struct usb_cdc_dmm_desc *usb_cdc_dmm_desc;
    33		struct usb_cdc_mdlm_desc *usb_cdc_mdlm_desc;
    34		struct usb_cdc_mdlm_detail_desc *usb_cdc_mdlm_detail_desc;
    35		struct usb_cdc_obex_desc *usb_cdc_obex_desc;
    36		struct usb_cdc_ncm_desc *usb_cdc_ncm_desc;
    37		struct usb_cdc_mbim_desc *usb_cdc_mbim_desc;
    38		struct usb_cdc_mbim_extended_desc *usb_cdc_mbim_extended_desc;
    39	
    40		bool phonet_magic_present;
    41	};
    42	
    43	
    44	int cdc_parse_cdc_header(struct usb_cdc_parsed_header *hdr,
    45					struct usb_interface *intf,
    46					u8 *buffer,
  > 47					int buflen);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Re: [net-next:master 6/12] include/linux/usb/cdc.h:23: error: redefinition of 'struct usb_cdc_parsed_header'

From: David Miller <davem@davemloft.net>
Date: 2015-09-15 20:27:44

From: kbuild test robot <redacted>
Date: Wed, 16 Sep 2015 03:57:11 +0800
All error/warnings (new ones prefixed by >>):

   In file included from drivers/usb/gadget/function/u_ether.h:20,
                    from drivers/usb/gadget/legacy/cdc2.c:16:
   include/linux/usb/cdc.h:47: warning: 'struct usb_interface' declared inside parameter list
   include/linux/usb/cdc.h:47: warning: its scope is only this definition or declaration, which is probably not what you want
   In file included from drivers/usb/gadget/function/u_serial.h:16,
                    from drivers/usb/gadget/legacy/cdc2.c:17:
quoted
quoted
include/linux/usb/cdc.h:23: error: redefinition of 'struct usb_cdc_parsed_header'
   include/linux/usb/cdc.h:47: warning: 'struct usb_interface' declared inside parameter list
quoted
quoted
include/linux/usb/cdc.h:47: error: conflicting types for 'cdc_parse_cdc_header'
   include/linux/usb/cdc.h:47: error: previous declaration of 'cdc_parse_cdc_header' was here
This may be a side effect of the initial warning, does this reproduce with
that fixed?  Please show me what the warning looks like in that case.

Thanks.

Re: [net-next:master 6/12] include/linux/usb/cdc.h:23: error: redefinition of 'struct usb_cdc_parsed_header'

From: Fengguang Wu <hidden>
Date: 2015-09-16 13:06:59

On Tue, Sep 15, 2015 at 01:27:42PM -0700, David Miller wrote:
From: kbuild test robot <redacted>
Date: Wed, 16 Sep 2015 03:57:11 +0800
quoted
All error/warnings (new ones prefixed by >>):

   In file included from drivers/usb/gadget/function/u_ether.h:20,
                    from drivers/usb/gadget/legacy/cdc2.c:16:
   include/linux/usb/cdc.h:47: warning: 'struct usb_interface' declared inside parameter list
   include/linux/usb/cdc.h:47: warning: its scope is only this definition or declaration, which is probably not what you want
   In file included from drivers/usb/gadget/function/u_serial.h:16,
                    from drivers/usb/gadget/legacy/cdc2.c:17:
quoted
quoted
include/linux/usb/cdc.h:23: error: redefinition of 'struct usb_cdc_parsed_header'
   include/linux/usb/cdc.h:47: warning: 'struct usb_interface' declared inside parameter list
quoted
quoted
include/linux/usb/cdc.h:47: error: conflicting types for 'cdc_parse_cdc_header'
   include/linux/usb/cdc.h:47: error: previous declaration of 'cdc_parse_cdc_header' was here
This may be a side effect of the initial warning, does this reproduce with
that fixed?  Please show me what the warning looks like in that case.
Dave, net-next/master commit ad1e7b97b3 ("cdc: Fix build warning.")
still has errors.

The problem is, the header file <linux/usb/cdc.h> is included twice.

recent_errors
├── arm-arm5
│   ├── include-linux-usb-cdc.h:error:conflicting-types-for-cdc_parse_cdc_header
│   └── include-linux-usb-cdc.h:error:redefinition-of-struct-usb_cdc_parsed_header
├── arm-arm67
│   ├── include-linux-usb-cdc.h:error:conflicting-types-for-cdc_parse_cdc_header
│   └── include-linux-usb-cdc.h:error:redefinition-of-struct-usb_cdc_parsed_header
├── arm-mmp
│   ├── include-linux-usb-cdc.h:error:conflicting-types-for-cdc_parse_cdc_header
│   └── include-linux-usb-cdc.h:error:redefinition-of-struct-usb_cdc_parsed_header
├── arm-omap2plus_defconfig
│   ├── include-linux-usb-cdc.h:error:conflicting-types-for-cdc_parse_cdc_header
│   └── include-linux-usb-cdc.h:error:redefinition-of-struct-usb_cdc_parsed_header
├── avr32-atngw100_defconfig
│   └── include-linux-usb-cdc.h:error:redefinition-of-struct-usb_cdc_parsed_header
├── avr32-atstk1006_defconfig
│   └── include-linux-usb-cdc.h:error:redefinition-of-struct-usb_cdc_parsed_header
└── i386-allmodconfig
    ├── include-linux-usb-cdc.h:error:conflicting-types-for-cdc_parse_cdc_header
    └── include-linux-usb-cdc.h:error:redefinition-of-struct-usb_cdc_parsed_header

The error messages are now:

In file included from drivers/usb/gadget/function/u_ether.h:20:0,
                 from drivers/usb/gadget/function/f_ncm.c:26:
include/linux/usb/cdc.h:23:8: error: redefinition of 'struct usb_cdc_parsed_header'
 struct usb_cdc_parsed_header {
        ^
In file included from drivers/usb/gadget/function/f_ncm.c:24:0:
include/linux/usb/cdc.h:23:8: note: originally defined here
 struct usb_cdc_parsed_header {
        ^
In file included from drivers/usb/gadget/function/u_ether.h:20:0,
                 from drivers/usb/gadget/function/f_ncm.c:26:
include/linux/usb/cdc.h:44:5: error: conflicting types for 'cdc_parse_cdc_header'
 int cdc_parse_cdc_header(struct usb_cdc_parsed_header *hdr,
     ^
In file included from drivers/usb/gadget/function/f_ncm.c:24:0:
include/linux/usb/cdc.h:44:5: note: previous declaration of 'cdc_parse_cdc_header' was here
 int cdc_parse_cdc_header(struct usb_cdc_parsed_header *hdr,
     ^

Thanks,
Fengguang

Re: [net-next:master 6/12] include/linux/usb/cdc.h:23: error: redefinition of 'struct usb_cdc_parsed_header'

From: David Miller <davem@davemloft.net>
Date: 2015-09-16 17:54:55

From: Fengguang Wu <redacted>
Date: Wed, 16 Sep 2015 21:06:58 +0800
On Tue, Sep 15, 2015 at 01:27:42PM -0700, David Miller wrote:
quoted
From: kbuild test robot <redacted>
Date: Wed, 16 Sep 2015 03:57:11 +0800
quoted
All error/warnings (new ones prefixed by >>):

   In file included from drivers/usb/gadget/function/u_ether.h:20,
                    from drivers/usb/gadget/legacy/cdc2.c:16:
   include/linux/usb/cdc.h:47: warning: 'struct usb_interface' declared inside parameter list
   include/linux/usb/cdc.h:47: warning: its scope is only this definition or declaration, which is probably not what you want
   In file included from drivers/usb/gadget/function/u_serial.h:16,
                    from drivers/usb/gadget/legacy/cdc2.c:17:
quoted
quoted
include/linux/usb/cdc.h:23: error: redefinition of 'struct usb_cdc_parsed_header'
   include/linux/usb/cdc.h:47: warning: 'struct usb_interface' declared inside parameter list
quoted
quoted
include/linux/usb/cdc.h:47: error: conflicting types for 'cdc_parse_cdc_header'
   include/linux/usb/cdc.h:47: error: previous declaration of 'cdc_parse_cdc_header' was here
This may be a side effect of the initial warning, does this reproduce with
that fixed?  Please show me what the warning looks like in that case.
Dave, net-next/master commit ad1e7b97b3 ("cdc: Fix build warning.")
still has errors.

The problem is, the header file <linux/usb/cdc.h> is included twice.
That's not possible after the patch I committed from Stephen Rothwell
which adds proper include guards:

====================
commit b84ee0d7f375ed7840c7c110d46eac24cf94b2a2
Author: Stephen Rothwell [off-list ref]
Date:   Wed Sep 16 11:10:16 2015 +1000

    cdc: add header guards
    
    Signed-off-by: Stephen Rothwell [off-list ref]
    Signed-off-by: David S. Miller [off-list ref]
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 959d0c8..b5706f9 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -7,6 +7,8 @@
  * modify it under the terms of the GNU General Public License
  * version 2 as published by the Free Software Foundation.
  */
+#ifndef __LINUX_USB_CDC_H
+#define __LINUX_USB_CDC_H
 
 #include <uapi/linux/usb/cdc.h>
 
@@ -45,3 +47,5 @@ int cdc_parse_cdc_header(struct usb_cdc_parsed_header *hdr,
 				struct usb_interface *intf,
 				u8 *buffer,
 				int buflen);
+
+#endif /* __LINUX_USB_CDC_H */
diff --git a/include/uapi/linux/usb/cdc.h b/include/uapi/linux/usb/cdc.h
index b6a9cdd..e2bc417 100644
--- a/include/uapi/linux/usb/cdc.h
+++ b/include/uapi/linux/usb/cdc.h
@@ -6,8 +6,8 @@
  * firmware based USB peripherals.
  */
 
-#ifndef __LINUX_USB_CDC_H
-#define __LINUX_USB_CDC_H
+#ifndef __UAPI_LINUX_USB_CDC_H
+#define __UAPI_LINUX_USB_CDC_H
 
 #include <linux/types.h>
 
@@ -444,4 +444,4 @@ struct usb_cdc_ncm_ndp_input_size {
 #define USB_CDC_NCM_CRC_NOT_APPENDED			0x00
 #define USB_CDC_NCM_CRC_APPENDED			0x01
 
-#endif /* __LINUX_USB_CDC_H */
+#endif /* __UAPI_LINUX_USB_CDC_H */

Re: [net-next:master 6/12] include/linux/usb/cdc.h:23: error: redefinition of 'struct usb_cdc_parsed_header'

From: Fengguang Wu <hidden>
Date: 2015-09-16 22:51:21

On Wed, Sep 16, 2015 at 10:54:54AM -0700, David Miller wrote:
From: Fengguang Wu <redacted>
Date: Wed, 16 Sep 2015 21:06:58 +0800
quoted
On Tue, Sep 15, 2015 at 01:27:42PM -0700, David Miller wrote:
quoted
From: kbuild test robot <redacted>
Date: Wed, 16 Sep 2015 03:57:11 +0800
quoted
All error/warnings (new ones prefixed by >>):

   In file included from drivers/usb/gadget/function/u_ether.h:20,
                    from drivers/usb/gadget/legacy/cdc2.c:16:
   include/linux/usb/cdc.h:47: warning: 'struct usb_interface' declared inside parameter list
   include/linux/usb/cdc.h:47: warning: its scope is only this definition or declaration, which is probably not what you want
   In file included from drivers/usb/gadget/function/u_serial.h:16,
                    from drivers/usb/gadget/legacy/cdc2.c:17:
quoted
quoted
include/linux/usb/cdc.h:23: error: redefinition of 'struct usb_cdc_parsed_header'
   include/linux/usb/cdc.h:47: warning: 'struct usb_interface' declared inside parameter list
quoted
quoted
include/linux/usb/cdc.h:47: error: conflicting types for 'cdc_parse_cdc_header'
   include/linux/usb/cdc.h:47: error: previous declaration of 'cdc_parse_cdc_header' was here
This may be a side effect of the initial warning, does this reproduce with
that fixed?  Please show me what the warning looks like in that case.
Dave, net-next/master commit ad1e7b97b3 ("cdc: Fix build warning.")
still has errors.

The problem is, the header file <linux/usb/cdc.h> is included twice.
That's not possible after the patch I committed from Stephen Rothwell
which adds proper include guards:
Yes, this patch fixed the errors nicely!

Thanks,
Fengguang
quoted hunk
====================
commit b84ee0d7f375ed7840c7c110d46eac24cf94b2a2
Author: Stephen Rothwell [off-list ref]
Date:   Wed Sep 16 11:10:16 2015 +1000

    cdc: add header guards
    
    Signed-off-by: Stephen Rothwell [off-list ref]
    Signed-off-by: David S. Miller [off-list ref]
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 959d0c8..b5706f9 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -7,6 +7,8 @@
  * modify it under the terms of the GNU General Public License
  * version 2 as published by the Free Software Foundation.
  */
+#ifndef __LINUX_USB_CDC_H
+#define __LINUX_USB_CDC_H
 
 #include <uapi/linux/usb/cdc.h>
 
@@ -45,3 +47,5 @@ int cdc_parse_cdc_header(struct usb_cdc_parsed_header *hdr,
 				struct usb_interface *intf,
 				u8 *buffer,
 				int buflen);
+
+#endif /* __LINUX_USB_CDC_H */
diff --git a/include/uapi/linux/usb/cdc.h b/include/uapi/linux/usb/cdc.h
index b6a9cdd..e2bc417 100644
--- a/include/uapi/linux/usb/cdc.h
+++ b/include/uapi/linux/usb/cdc.h
@@ -6,8 +6,8 @@
  * firmware based USB peripherals.
  */
 
-#ifndef __LINUX_USB_CDC_H
-#define __LINUX_USB_CDC_H
+#ifndef __UAPI_LINUX_USB_CDC_H
+#define __UAPI_LINUX_USB_CDC_H
 
 #include <linux/types.h>
 
@@ -444,4 +444,4 @@ struct usb_cdc_ncm_ndp_input_size {
 #define USB_CDC_NCM_CRC_NOT_APPENDED			0x00
 #define USB_CDC_NCM_CRC_APPENDED			0x01
 
-#endif /* __LINUX_USB_CDC_H */
+#endif /* __UAPI_LINUX_USB_CDC_H */
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help