On Thursday 02 August 2007, Alan Stern wrote:
> On Thu, 2 Aug 2007, David Brownell wrote:
> 
> > Clean up the file storage gadget, using newer APIs and conventions:
> > 
> >  - gadget_is_dualspeed() and gadget_is_otg() ... #ifdef removal
> > 
> >  - Remove many now-needless #includes
> > 
> >  - Use the DEBUG (from Kconfig+Makefile) and VERBOSE_DEBUG conventions.
> > 
> >  - Remove some "sparse" warnings (it still dislikes the __user annotations)
> > 
> > This gave only a minor object code shrinkage.
> 
> I'd rather expect to see a minor increase in object code size, since a
> few data structures and lines of code are now compiled in that
> previously would have been #ifdef'ed out.

GCC dead code optimization ensures they don't cluter up
the generated object code.  Briefly, in;

        static struct ... somedata = { ... };

        static void fn1(...) { accesses somedata }

        void fn2(...)
        {
                ...
                if (0)
                        fn1(...);
                ...
        }

then fn2() will be in the object, but not fn1 or somedata.


> Why do you think the code size shrank?

In this case, because runtime "is this an OTG gadget?" test
was replaced by a compile time "of course not, it couldn't be"
result ... so GCC could detect the dead code.


> > --- g26.orig/drivers/usb/gadget/file_storage.c      2007-08-01 
> > 23:16:10.000000000 -0700
> > +++ g26/drivers/usb/gadget/file_storage.c   2007-08-01 23:29:00.000000000 
> > -0700
> > @@ -289,57 +275,51 @@ MODULE_LICENSE("Dual BSD/GPL");
> >  
> >  
> > /*-------------------------------------------------------------------------*/
> >  
> > -#define xprintk(f,level,fmt,args...) \
> > -   dev_printk(level , &(f)->gadget->dev , fmt , ## args)
> >  #define yprintk(l,level,fmt,args...) \
> >     dev_printk(level , &(l)->dev , fmt , ## args)
> 
> Is there any particular reason you expanded xprintk inline but not
> yprintk?

Because I was doing a quick conversion, copy/paste from other
code where the "xprintk" thing got removed.  You're right that
there's still additional cleanup that can be done.


> Despite these questions, ACK.

Thanks.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
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