Skip to contentSkip to conversation

Invalid Storage Class BUG

DISCUSSION Felipe Balbi 5 participants 7 messages Nov 1, 2006 USB

lore
Share & tools
lore
#0 lore raw

Hello all,

Could anyone help me fix this bug?

I couldn't figure out what is happening.

Here's the bug:
drivers/usb/core/hub.c: In function 'usb_new_device':
drivers/usb/core/hub.c:1293: error: invalid storage class for function '__usb_port_suspend'
drivers/usb/core/hub.c:1294: warning: implicit declaration of function '__usb_port_suspend'
drivers/usb/core/hub.c: At top level:
drivers/usb/core/hub.c:1567: error: static declaration of '__usb_port_suspend' follows non-static declaration drivers/usb/core/hub.c:1294: error: previous implicit declaration of '__usb_port_suspend' was here
make[3]: *** [drivers/usb/core/hub.o] Error 1
make[2]: *** [drivers/usb/core] Error 2
make[1]: *** [drivers/usb] Error 2
make: *** [drivers] Error 2

Here's the source code:

/* Maybe it can talk to us, though we can't talk to it.
* (Includes HNP test device.)
*/
if (udev->bus->b_hnp_enable || udev->bus->is_b_host) {
static int __usb_port_suspend(struct usb_device *,
int port1); * (line 1293)*
err = __usb_port_suspend(udev,
udev->bus->otg_port); * (line 1294)*

                        if (err < 0)
                                dev_dbg(&udev->dev, "HNP fail, %d\n", err);
                }
                err = -ENODEV;
                goto fail;
        }

static int __usb_port_suspend (struct usb_device *udev, int port1) { * (line 1567)*

        int     status = 0;

        /* caller owns the udev device lock */
        if (port1 < 0)
                return port1;

        /* we change the device's upstream USB link,
         * but root hubs have no upstream USB link.
         */
        if (udev->parent)
                status = hub_port_suspend(hdev_to_hub(udev->parent), port1,
                                udev);
        else {
                dev_dbg(&udev->dev, "usb %ssuspend\n",
                                udev->auto_pm ? "auto-" : "");
                usb_set_device_state(udev, USB_STATE_SUSPENDED);
        }
        return status;
}
Signature · 16 lines
Best Regards,

Felipe Balbi
[email protected]
OSMRC - INdT


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
#1 lore raw
Quoted 6 lines · Felipe Balbi

Hello all,

Could anyone help me fix this bug?

I couldn't figure out what is happening.

Quoted 15 lines

Here's the bug:
drivers/usb/core/hub.c: In function 'usb_new_device':
drivers/usb/core/hub.c:1293: error: invalid storage class for function '__usb_port_suspend'
drivers/usb/core/hub.c:1294: warning: implicit declaration of function '__usb_port_suspend'
drivers/usb/core/hub.c: At top level:
drivers/usb/core/hub.c:1567: error: static declaration of '__usb_port_suspend' follows non-static declaration drivers/usb/core/hub.c:1294: error: previous implicit declaration of '__usb_port_suspend' was here
make[3]: *** [drivers/usb/core/hub.o] Error 1
make[2]: *** [drivers/usb/core] Error 2
make[1]: *** [drivers/usb] Error 2
make: *** [drivers] Error 2

Ho, ho!

Andrew, I _told_ you this inner declaration of a static function would cause problems!

Quoted 10 lines

Here's the source code:

/* Maybe it can talk to us, though we can't talk to it.
* (Includes HNP test device.)
*/
if (udev->bus->b_hnp_enable || udev->bus->is_b_host) {
static int __usb_port_suspend(struct usb_device *,
int port1); * (line 1293)*
err = __usb_port_suspend(udev,
udev->bus->otg_port); * (line 1294)*

Quoted 6 lines
                        if (err < 0)
                                dev_dbg(&udev->dev, "HNP fail, %d\n", err);
                }
                err = -ENODEV;
                goto fail;
        }

The solution is simple. Just take line 1293 (the static function declaration) and move it outside of the usb_new_device() function. Stick it inside the "#ifdef CONFIG_USB_OTG" block just above the function's start.

The problem is that gcc 4 doesn't like static function declarations in inner blocks. Earlier versions of gcc didn't mind.

Alan Stern

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

#3 lore raw
In reply to Felipe Balbi
Quoted 1 line · Felipe Balbi

Hello all,

Hi !

Quoted 5 lines

Could anyone help me fix this bug?

I couldn't figure out what is happening.

Quoted 16 lines

Here's the bug:
drivers/usb/core/hub.c: In function 'usb_new_device':
drivers/usb/core/hub.c:1293: error: invalid storage class for function '__usb_port_suspend'
drivers/usb/core/hub.c:1294: warning: implicit declaration of function '__usb_port_suspend'
drivers/usb/core/hub.c: At top level:
drivers/usb/core/hub.c:1567: error: static declaration of '__usb_port_suspend' follows non-static declaration drivers/usb/core/hub.c:1294: error: previous implicit declaration of '__usb_port_suspend' was here
make[3]: *** [drivers/usb/core/hub.o] Error 1
make[2]: *** [drivers/usb/core] Error 2
make[1]: *** [drivers/usb] Error 2
make: *** [drivers] Error 2

Try the attached patch. It's a quick fix/hack and has not been tested in every configurations but it should be enough to get things working.

Regards,
Arnaud Patard

---
drivers/usb/core/hub.c | 3 1 + 2 - 0 !

 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/core/hub.c +1 -2
Index: linux-omap-2.6/drivers/usb/core/hub.c
===================================================================
@@ -1188,6 +1188,7 @@ static inline void show_string(struct us
 
 #ifdef	CONFIG_USB_OTG
 #include "otg_whitelist.h"
+static int __usb_port_suspend(struct usb_device *udev, int port1);
 #endif
 
 /**
@@ -1289,8 +1290,6 @@ int usb_new_device(struct usb_device *ud
 		 * (Includes HNP test device.)
 		 */
 		if (udev->bus->b_hnp_enable || udev->bus->is_b_host) {
-			static int __usb_port_suspend(struct usb_device *,
-						int port1);
 			err = __usb_port_suspend(udev, udev->bus->otg_port);
 			if (err < 0)
 				dev_dbg(&udev->dev, "HNP fail, %d\n", err);

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

#2 lore raw
In reply to Alan Stern
Quoted 24 lines · On Wed, 1 Nov 2006 16:14:01 -0500 (EST) Alan Stern <[email protected]>…
Quoted 6 lines · Felipe Balbi

Hello all,

Could anyone help me fix this bug?

I couldn't figure out what is happening.

Quoted 15 lines

Here's the bug:
drivers/usb/core/hub.c: In function 'usb_new_device':
drivers/usb/core/hub.c:1293: error: invalid storage class for function '__usb_port_suspend'
drivers/usb/core/hub.c:1294: warning: implicit declaration of function '__usb_port_suspend'
drivers/usb/core/hub.c: At top level:
drivers/usb/core/hub.c:1567: error: static declaration of '__usb_port_suspend' follows non-static declaration drivers/usb/core/hub.c:1294: error: previous implicit declaration of '__usb_port_suspend' was here
make[3]: *** [drivers/usb/core/hub.o] Error 1
make[2]: *** [drivers/usb/core] Error 2
make[1]: *** [drivers/usb] Error 2
make: *** [drivers] Error 2

Quoted 4 lines

Ho, ho!

Andrew, I _told_ you this inner declaration of a static function would cause problems!

I thought we fixed that ages ago? What happened to it?

Quoted 17 lines
Quoted 10 lines

Here's the source code:

/* Maybe it can talk to us, though we can't talk to it.
* (Includes HNP test device.)
*/
if (udev->bus->b_hnp_enable || udev->bus->is_b_host) {
static int __usb_port_suspend(struct usb_device *,
int port1); * (line 1293)*
err = __usb_port_suspend(udev,
udev->bus->otg_port); * (line 1294)*

Quoted 6 lines
                        if (err < 0)
                                dev_dbg(&udev->dev, "HNP fail, %d\n", err);
                }
                err = -ENODEV;
                goto fail;
        }
Quoted 4 lines

The solution is simple. Just take line 1293 (the static function declaration) and move it outside of the usb_new_device() function. Stick it inside the "#ifdef CONFIG_USB_OTG" block just above the function's start.

It'd be better to rearrange things in there so that no forward declarations are needed. A manual tsort... But whatever. It'd be better if it compiled ;)

Quoted 2 lines

The problem is that gcc 4 doesn't like static function declarations in inner blocks. Earlier versions of gcc didn't mind.

Wanna send a 2.6.19 patch please?

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

#4 lore raw
In reply to Arnaud Patard (Rtp)

That's identical to what I've been using in some work on a high-speed OTG controller that I suspect Felipe is getting familiar with ... :)

So here's a standard format patch. This should get into 2.6.19 IMO.

(Andrew, ISTR that a topological sort won't work in this file.)

================= CUT HERE

Remove complaint from newer GCCs; they don't like forward function declarations except in top-level contexts.

drivers/usb/core/hub.c +1 -2
Index: h4/drivers/usb/core/hub.c
===================================================================
@@ -1188,6 +1188,7 @@ static inline void show_string(struct us
 
 #ifdef	CONFIG_USB_OTG
 #include "otg_whitelist.h"
+static int __usb_port_suspend(struct usb_device *, int port1);
 #endif
 
 /**
@@ -1289,8 +1290,6 @@ int usb_new_device(struct usb_device *ud
 		 * (Includes HNP test device.)
 		 */
 		if (udev->bus->b_hnp_enable || udev->bus->is_b_host) {
-			static int __usb_port_suspend(struct usb_device *,
-						int port1);
 			err = __usb_port_suspend(udev, udev->bus->otg_port);
 			if (err < 0)
 				dev_dbg(&udev->dev, "HNP fail, %d\n", err);

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

#5 lore raw
Quoted 1 line · On Wed, 1 Nov 2006 14:26:26 -0800 David Brownell <[email protected]> wrote:

So here's a standard format patch. This should get into 2.6.19 IMO.

-> Greg.

Quoted 1 line

(Andrew, ISTR that a topological sort won't work in this file.)

I did one just then. It worked for allmodconfig, but it was too big so I deleted it.

#6 lore raw
Quoted 5 lines
Quoted 2 lines

(Andrew, ISTR that a topological sort won't work in this file.)

I did one just then. It worked for allmodconfig, but it was too big so I deleted it.

OK. It was a few releases ago, then, that a topsort couldn't work; Alan's various updates have improved that aspect too.

I always like to see forward declarations removed, myself, and I'm glad not to be alone in that. ;)

- Dave

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel