[PATCH] staging/comedi: Use comedi_pci_auto_unconfig directly for pci_driver.remove

Peter Hüwe PeterHuewe at gmx.de
Tue Jan 22 23:02:48 UTC 2013


Am Dienstag, 22. Januar 2013, 23:49:53 schrieb H Hartley Sweeten:
> On Tuesday, January 22, 2013 3:40 PM, Peter Huewe wrote:
> >  (Almost) all comedi pci drivers have some wrapper for their
> > 
> > pci_driver.remove function which simply calls comedi_pci_auto_unconfig
> > which has the same function prototype as the wrapper.
> > 
> > -> we can remove these wrappers and call comedi_pci_auto_unconfig
> > directly. This removes a lot some boilerplate code and saves some bytes.
> > 
> > Signed-off-by: Peter Huewe <peterhuewe at gmx.de>
> > ---
> > Maybe we should move the implementation now to drivers.c,
> > because now it cannot be inlined anymore.
> > This would save some more bytes in the .kos but comedi_pci_auto_unconfig
> > then has to become an exported symbol.
> 
> Did you build this?
> 
> As you mention above, the inlined comedi_pci_auto_unconfig() will not
> work as a function pointer in the pci_driver structs.
> 
> This cannot work until/if comedi_pci_auto_unconfig() is made an exported
> symbol. I'll leave that decision up to Ian.
> 
> Regards,
> Hartley

Hi,

yes I did build it - and it did build fine.
That's how I could find out about the size of the .kos 

On my machine all comedi .kos before the patch sum up to 9828 bytes.
After applying this patch it comes down to 9812 bytes
If I put the comedi_pci_auto_unconfig into drivers.c and export it, it comes 
down to 9752 bytes.


The gcc probably simply does not inline it anymore - inline is just a 
suggestion to the compiler.

I did some google searching before submitting it, and it seems that is indeed 
possible.
e.g.:
http://stackoverflow.com/questions/8885665/c-pointer-to-inline-function

Nevertheless I'll send a patch which moves the  comedi_pci_auto_unconfig to 
drivers.c

Thanks,
Peter






More information about the devel mailing list