Re: Serial maintainership

From: Linus Torvalds
Date: Thu Sep 08 2005 - 15:40:37 EST




On Thu, 8 Sep 2005, David S. Miller wrote:
>
> > the "regs" argument may not exist in the parent context in the
> > !SUPPORT_SYSRQ case.
>
> Then pass in a NULL in the ARM serial drivers instead of this ugly
> dependency upon the macro not using the argument.

No, the ARM driver -does- want to pass in "regs" for the SYSRQ case, it's
just that "regs" doesn't even exist when SYSRQ is not enabled. Look into
drivers/serial/amba-pl010.c as an example.

Yes, it's a bit ugly, but we've had similar cases in other places. And
it's likely a valid optimization, and the old code worked beautifully by
just not even caring when "regs" wasn't used due to SYSRQ not being
enabled.

We've had somewhat similar cases where optimizations depended on macros
not even expanding their arguments when they aren't used (ie the arguments
might be expensive to expand: function calls or inline asm that the
compiler can't remove even if the result isn't used).

So it's certainly a valid optimization to know that the arguments aren't
even evaluated, and thus it's sometimes really wrong to change a macro
into an inline function.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/