Skip to contentSkip to conversation

usb: g_ffs: fix compilation warning

PATCH In review David Cohen 3 participants 4 messages Oct 4, 2013 – Oct 7, 2013 USB

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 usb: g_ffs: fix compilation warning

If USB_FUNCTIONFS is selected without USB_FUNCTIONFS_ETH and USB_FUNCTIONFS_RNIS, u_ether.h won't be included and then USB_ETHERNET_MODULE_PARAMAETERS macro won't be available causing the following warning compilation:

drivers/usb/gadget/g_ffs.c:81:1: warning: data definition has no type or storage class [enabled by default] drivers/usb/gadget/g_ffs.c:81:1: warning: type defaults to ‘int’ in declaration of ‘USB_ETHERNET_MODULE_PARAMETERS’ [-Wimplicit-int] drivers/usb/gadget/g_ffs.c:81:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]

This patch fixes the warning by making USB_ETHERNET_MODULE_PARAMETERS to be used iff u_ether.h is included, otherwise it is not needed.

---
 drivers/usb/gadget/g_ffs.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/gadget/g_ffs.c +2 -0
index 5327c82..2344efe 100644
@@ -76,7 +76,9 @@ struct gfs_ffs_obj {
 
 USB_GADGET_COMPOSITE_OPTIONS();
 
+#if defined CONFIG_USB_FUNCTIONFS_ETH || defined CONFIG_USB_FUNCTIONFS_RNDIS
 USB_ETHERNET_MODULE_PARAMETERS();
+#endif
 
 static struct usb_device_descriptor gfs_dev_desc = {
 	.bLength		= sizeof gfs_dev_desc,
Signature · 1 line
1.8.4.rc3
#1 lore raw

Hi Greg,

Quoted 25 lines · David Cohen

If USB_FUNCTIONFS is selected without USB_FUNCTIONFS_ETH and USB_FUNCTIONFS_RNIS, u_ether.h won't be included and then USB_ETHERNET_MODULE_PARAMAETERS macro won't be available causing the following warning compilation:

drivers/usb/gadget/g_ffs.c:81:1: warning: data definition has no type or storage class [enabled by default] drivers/usb/gadget/g_ffs.c:81:1: warning: type defaults to ‘int’ in declaration of ‘USB_ETHERNET_MODULE_PARAMETERS’ [-Wimplicit-int] drivers/usb/gadget/g_ffs.c:81:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]

This patch fixes the warning by making USB_ETHERNET_MODULE_PARAMETERS to be used iff u_ether.h is included, otherwise it is not needed.

---
  drivers/usb/gadget/g_ffs.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/usb/gadget/g_ffs.c +0 -0
index 5327c82..2344efe 100644

drivers/usb/gadget/g_ffs.c struct gfs_ffs_obj { · line 80

Quoted 5 lines
drivers/usb/gadget/g_ffs.c +1 -0
@@ -76,7 +76,9 @@ struct gfs_ffs_obj {
 
  USB_GADGET_COMPOSITE_OPTIONS();
 
+#if defined CONFIG_USB_FUNCTIONFS_ETH || defined CONFIG_USB_FUNCTIONFS_RNDIS
  USB_ETHERNET_MODULE_PARAMETERS();

This warning happens on kernel v3.11+
But luckily it has no real effect on kernel despite the warning, so no tests would report it.

Br, David Cohen

Quoted 5 lines
drivers/usb/gadget/g_ffs.c +1 -0
+#endif
 
  static struct usb_device_descriptor gfs_dev_desc = {
  	.bLength		= sizeof gfs_dev_desc,
#2 lore raw
In reply to David Cohen

Hello.

Quoted 25 lines · David Cohen

If USB_FUNCTIONFS is selected without USB_FUNCTIONFS_ETH and USB_FUNCTIONFS_RNIS, u_ether.h won't be included and then USB_ETHERNET_MODULE_PARAMAETERS macro won't be available causing the following warning compilation:

drivers/usb/gadget/g_ffs.c:81:1: warning: data definition has no type or storage class [enabled by default] drivers/usb/gadget/g_ffs.c:81:1: warning: type defaults to ‘int’ in declaration of ‘USB_ETHERNET_MODULE_PARAMETERS’ [-Wimplicit-int] drivers/usb/gadget/g_ffs.c:81:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]

This patch fixes the warning by making USB_ETHERNET_MODULE_PARAMETERS to be used iff u_ether.h is included, otherwise it is not needed.

---
  drivers/usb/gadget/g_ffs.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/usb/gadget/g_ffs.c +0 -0
index 5327c82..2344efe 100644

drivers/usb/gadget/g_ffs.c struct gfs_ffs_obj { · line 79

Quoted 4 lines
drivers/usb/gadget/g_ffs.c +1 -0
@@ -76,7 +76,9 @@ struct gfs_ffs_obj {
 
  USB_GADGET_COMPOSITE_OPTIONS();
 
+#if defined CONFIG_USB_FUNCTIONFS_ETH || defined CONFIG_USB_FUNCTIONFS_RNDIS

I thought the 'defined' operator requires ()?

WBR, Sergei

#3 lore raw

Hi Sergei,

(replying from my personal e-mail)

Quoted 35 lines · Sergei Shtylyov

Hello.

Quoted 30 lines · David Cohen

If USB_FUNCTIONFS is selected without USB_FUNCTIONFS_ETH and USB_FUNCTIONFS_RNIS, u_ether.h won't be included and then USB_ETHERNET_MODULE_PARAMAETERS macro won't be available causing the following warning compilation:

drivers/usb/gadget/g_ffs.c:81:1: warning: data definition has no type or storage class [enabled by default] drivers/usb/gadget/g_ffs.c:81:1: warning: type defaults to ‘int’ in declaration of ‘USB_ETHERNET_MODULE_PARAMETERS’ [-Wimplicit-int] drivers/usb/gadget/g_ffs.c:81:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]

This patch fixes the warning by making USB_ETHERNET_MODULE_PARAMETERS to be used iff u_ether.h is included, otherwise it is not needed.

---
  drivers/usb/gadget/g_ffs.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/usb/gadget/g_ffs.c +0 -0
index 5327c82..2344efe 100644
@@ -76,7 +76,9 @@ struct gfs_ffs_obj {
 
Quoted 6 lines

drivers/usb/gadget/g_ffs.c struct gfs_ffs_obj { · line 79

Quoted 3 lines
drivers/usb/gadget/g_ffs.c +1 -0
  USB_GADGET_COMPOSITE_OPTIONS();
 
+#if defined CONFIG_USB_FUNCTIONFS_ETH || defined CONFIG_USB_FUNCTIONFS_RNDIS

I thought the 'defined' operator requires ()?

I though the same. But I copied this line from this same file when it's deciding whether to include u_ether.h or not.

BR, David Cohen