[PATCH 2/2] b43: implement BCMA bus ops

Michael Büsch m at bues.ch
Wed Jul 6 11:58:10 EDT 2011


On Wed, 6 Jul 2011 17:52:40 +0200
Rafał Miłecki <zajec5 at gmail.com> wrote:
> >> +/* BCMA */
> >> +#ifdef CONFIG_B43_BCMA
> >> +static inline int b43_bus_bcma_bus_may_powerdown(struct b43_bus_dev *dev)
> >> +{
> >> +     return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */
> >> +}
> >
> > Why is this inline?
> > You can't inline and take a pointer of the function at the same time.
> > (The compiler will workaround this by generating multiple versions of
> > the function, of which at least one is not inline).
> > So remove it, please. Same below...
> 
> I didn't know about any such a limitation.

This is not a limitation. It's just the way it is. You can't take
a reference to an object, that doesn't exist as an independent object.

So in this case, if there are no static callers of your function, the
compiler will simply ignore the inline. However, if there were other static
callers (in addition to the indirect callers through pointer), the compiler
would generate (most likely) an inline version for the static callers
and additionally a non-inline version for the indirect callers.

> Just for sure: did you really mean "pointer of the function"? Cause my
> function is taking pointer of the struct, not pointer of function.

You are taking the pointer to the function (C adds the & for you, so you only
need the function name) and put it into the bus struct.



More information about the b43-dev mailing list