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

Rafał Miłecki zajec5 at gmail.com
Wed Jul 6 12:02:41 EDT 2011


W dniu 6 lipca 2011 17:58 użytkownik Michael Büsch <m at bues.ch> napisał:
> 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.

Ohh, I though you mean getting function pointer as argument of
b43_bus_bcma_bus_may_powerdown
function.

Of course you meant taking pointer in this place:
dev->bus_may_powerdown = b43_bus_bcma_bus_may_powerdown;


Now I see the problem, thanks.

-- 
Rafał



More information about the b43-dev mailing list