On Wed, 27 Sep 2006, Andrew Morton wrote:

> On Tue, 26 Sep 2006 14:46:16 -0400 (EDT)
> Alan Stern <[EMAIL PROTECTED]> wrote:
> 
> > +           if (!autostopped) {
> > +                   static int ohci_restart (struct ohci_hcd *ohci);
> > +
> > +                   spin_unlock_irq (&ohci->lock);
> > +                   (void) ohci_init (ohci);
> > +                   status = ohci_restart (ohci);
> > +                   spin_lock_irq (&ohci->lock);
> > +           }
> 
> drivers/usb/host/ohci-hub.c: In function 'ohci_rh_resume':
> drivers/usb/host/ohci-hub.c:184: error: invalid storage class for function 
> 'ohci_restart'                                                                
>        
> 
> 
> What on earth _is_ this crap?  Collateral damage from USB's bizarre
> include-a-C-file-from-a-C-file thing?

No.  It's a sign that I'm using an older version of GCC than you are.  
It compiles just fine on my system.  :-(

I moved the function declaration into the inner block in order to _avoid_
a compiler warning!  When you build the driver with your
"ohci-add-auto-stop-support-hack-hack" installed and CONFIG_PM not set,
does your compiler complain about ohci_restart being declared `static' but
never defined?  Mine does.

Sigh...  This deserves to be cleaned up properly, but if you don't mind 
I'll put it off for a little while.

BTW, we've had equivalent code in the USB core drivers for a long time.  
>From drivers/usb/core/hub.c:

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

I assume that this hasn't bothered you because you never have
CONFIG_USB_OTG set during a build, so the compiler never sees this code.


> btw, could USB please consider tidying up its coding style sometime?  No
> random (void)'s, no random spaces between functions names and the opening
> paren?  <fat chance, but hope lives eternal>

The spaces were almost entirely the work of one rather prolific developer
(not me!) whose personal style is to always put a space between a function
name and the following open paren.  Cleaning it up will be a big job...
but I suppose it could be done over a period of time.

Alan Stern


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to