From: David Laight <david.laight.linux@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: andi.shyti@kernel.org, andriy.shevchenko@linux.intel.com,
masahiroy@kernel.org, u.kleine-koenig@baylibre.com,
linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org
Subject: Re: [PATCH] module: Allow DEFAULT_SYMBOL_NAMESPACE be set after export.h included
Date: Sun, 29 Dec 2024 00:59:36 +0000 [thread overview]
Message-ID: <20241229005936.4d54f2a6@dsl-u17-10> (raw)
In-Reply-To: <CAHk-=wi=7gHNhr0tOKQzSAhzR1TeAGQHYgh5+F1thaQkOZ094g@mail.gmail.com>
On Sat, 28 Dec 2024 15:29:24 -0800
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Sat, 28 Dec 2024 at 10:43, David Laight <david.laight.linux@gmail.com> 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 thought it was a neater 'ugly' than the current definitions in export.h
> I think the i2c code should just be fixed to use the proper "define
> namespace early".
The i2c changes were needed because I found the code wouldn't compile.
It is pretty easy mistake to make and will happen again.
and does - I missed drivers/pwm/pwm-lpss.c drivers/hwmon/nct6775-core.c
and drivers/pwm/pwm-lpss.c
I guess those files could be fixed by moving the definition '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.
What you really need is the preprocessor to support a ?: type operator
in an expansion. Then you can have (DEFAULT_SYMBOL_NAMESPACE ?: "") in
the expansion of EXPORT_SYMBOL().
>
> Linus
next prev parent reply other threads:[~2024-12-29 0:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-28 18:43 [PATCH] module: Allow DEFAULT_SYMBOL_NAMESPACE be set after export.h included David Laight
2024-12-28 21:38 ` Andy Shevchenko
2024-12-29 8:25 ` David Laight
2024-12-28 23:29 ` Linus Torvalds
2024-12-29 0:59 ` David Laight [this message]
2024-12-30 9:42 ` Uwe Kleine-König
2024-12-30 12:03 ` David Laight
2024-12-30 12:54 ` Uwe Kleine-König
2024-12-30 13:42 ` David Laight
2024-12-30 11:06 ` Masahiro Yamada
2024-12-29 0:45 ` kernel test robot
2024-12-29 3:32 ` kernel test robot
2024-12-30 10:49 ` Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241229005936.4d54f2a6@dsl-u17-10 \
--to=david.laight.linux@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=u.kleine-koenig@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox