public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* Invalid Storage Class BUG
@ 2006-11-01 20:50 Felipe Balbi
  2006-11-01 21:14 ` Alan Stern
  2006-11-01 21:32 ` Arnaud Patard
  0 siblings, 2 replies; 7+ messages in thread
From: Felipe Balbi @ 2006-11-01 20:50 UTC (permalink / raw)
  To: Linux OMAP Mailing List, linux-usb-devel

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


-- 
Best Regards,

Felipe Balbi
ext-felipe.lima@nokia.com
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
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Invalid Storage Class BUG
  2006-11-01 20:50 Invalid Storage Class BUG Felipe Balbi
@ 2006-11-01 21:14 ` Alan Stern
  2006-11-01 21:58   ` Andrew Morton
  2006-11-01 21:32 ` Arnaud Patard
  1 sibling, 1 reply; 7+ messages in thread
From: Alan Stern @ 2006-11-01 21:14 UTC (permalink / raw)
  To: Felipe Balbi, Andrew Morton; +Cc: Linux OMAP Mailing List, USB development list

On Wed, 1 Nov 2006, Felipe Balbi wrote:

> 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

Ho, ho!

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

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

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
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Invalid Storage Class BUG
  2006-11-01 20:50 Invalid Storage Class BUG Felipe Balbi
  2006-11-01 21:14 ` Alan Stern
@ 2006-11-01 21:32 ` Arnaud Patard
  2006-11-01 22:26   ` David Brownell
  1 sibling, 1 reply; 7+ messages in thread
From: Arnaud Patard @ 2006-11-01 21:32 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Linux OMAP Mailing List, linux-usb-devel

[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]

Felipe Balbi <ext-felipe.lima@nokia.com> writes:

> Hello all,

Hi !

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

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



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: usb_core_hub_breakage.patch --]
[-- Type: text/x-patch, Size: 929 bytes --]

---
 drivers/usb/core/hub.c |    3 	1 +	2 -	0 !
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: linux-omap-2.6/drivers/usb/core/hub.c
===================================================================
--- linux-omap-2.6.orig/drivers/usb/core/hub.c	2006-10-24 14:06:58.000000000 +0200
+++ linux-omap-2.6/drivers/usb/core/hub.c	2006-10-24 14:07:46.000000000 +0200
@@ -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);

[-- Attachment #3: Type: text/plain, Size: 373 bytes --]

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

[-- Attachment #4: Type: text/plain, Size: 191 bytes --]

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Invalid Storage Class BUG
  2006-11-01 21:14 ` Alan Stern
@ 2006-11-01 21:58   ` Andrew Morton
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Morton @ 2006-11-01 21:58 UTC (permalink / raw)
  To: Alan Stern; +Cc: Linux OMAP Mailing List, USB development list

On Wed, 1 Nov 2006 16:14:01 -0500 (EST)
Alan Stern <stern@rowland.harvard.edu> wrote:

> On Wed, 1 Nov 2006, Felipe Balbi wrote:
> 
> > 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
> 
> 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?

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

> 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
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Invalid Storage Class BUG
  2006-11-01 21:32 ` Arnaud Patard
@ 2006-11-01 22:26   ` David Brownell
  2006-11-01 22:41     ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: David Brownell @ 2006-11-01 22:26 UTC (permalink / raw)
  To: linux-omap-open-source
  Cc: Andrew Morton, linux-usb-devel, Arnaud Patard (Rtp), Greg KH

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.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>

Index: h4/drivers/usb/core/hub.c
===================================================================
--- h4.orig/drivers/usb/core/hub.c	2006-10-25 13:37:45.000000000 -0700
+++ h4/drivers/usb/core/hub.c	2006-10-25 21:54:17.000000000 -0700
@@ -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
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Invalid Storage Class BUG
  2006-11-01 22:26   ` David Brownell
@ 2006-11-01 22:41     ` Andrew Morton
  2006-11-01 22:48       ` David Brownell
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2006-11-01 22:41 UTC (permalink / raw)
  To: David Brownell; +Cc: Greg KH, linux-omap-open-source, linux-usb-devel

On Wed, 1 Nov 2006 14:26:26 -0800
David Brownell <david-b@pacbell.net> wrote:

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

-> Greg.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Invalid Storage Class BUG
  2006-11-01 22:41     ` Andrew Morton
@ 2006-11-01 22:48       ` David Brownell
  0 siblings, 0 replies; 7+ messages in thread
From: David Brownell @ 2006-11-01 22:48 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Greg KH, linux-omap-open-source, linux-usb-devel,
	Arnaud Patard (Rtp)


> > (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
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-11-01 22:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-01 20:50 Invalid Storage Class BUG Felipe Balbi
2006-11-01 21:14 ` Alan Stern
2006-11-01 21:58   ` Andrew Morton
2006-11-01 21:32 ` Arnaud Patard
2006-11-01 22:26   ` David Brownell
2006-11-01 22:41     ` Andrew Morton
2006-11-01 22:48       ` David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox