Re: [PATCH] module: Allow DEFAULT_SYMBOL_NAMESPACE be set after export.h included
From: Linus Torvalds
Date: Sat Dec 28 2024 - 18:29:52 EST
On Sat, 28 Dec 2024 at 10:43, David Laight <david.laight.linux@xxxxxxxxx> wrote:
>
> Instead just default DEFAULT_SYMBOL_NAMESPACE to "" and remove the
> extra _EXPORT_SYMBOL() wrapper.
>
> This lets DEFAULT_SYMBOL_NAMESPACE be defined after export.h is included.
Grr. This is horribly ugly.
I think the i2c code should just be fixed to use the proper "define
namespace early".
I will also note that 'sparse' has a notion of a "weak define", where
you can set a default value for a preprocessor symbol, but if it gets
redefined by the user (or already has a definition), sparse won't
complain about it, and just use the strong one.
That would have been lovely, and we could have had a
#weak_define DEFAULT_SYMBOL_NAMESPACE ""
and this wouldn't be the ugly mess it is.
I wish the regular C preprocessor could do the same. Oh well. Since it
doesn't, I really think i2c should just be fixed, and we shouldn't try
to deal with i2c having done things wrong.
Linus