From: David Laight <david.laight.linux@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
andi.shyti@kernel.org, andriy.shevchenko@linux.intel.com,
masahiroy@kernel.org, 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: Mon, 30 Dec 2024 12:03:03 +0000 [thread overview]
Message-ID: <20241230120303.691e7a5c@dsl-u17-10> (raw)
In-Reply-To: <ytxbpm4zmausomklykqeqaw3nnkaurqwsi76uejgq655ylmxyd@ubbetotmrqo3>
On Mon, 30 Dec 2024 10:42:55 +0100
Uwe Kleine-König <u.kleine-koenig@baylibre.com> wrote:
> On Sun, Dec 29, 2024 at 12:59:36AM +0000, David Laight wrote:
> > 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.
>
> There is
> https://lore.kernel.org/linux-i2c/20241203173640.1648939-2-u.kleine-koenig@baylibre.com
> that moves the DEFAULT_SYMBOL_NAMESPACE above the #include block for the
> i2c driver. Though it seems I missed ...master.c. (I'll address that.)
>
> > and does - I missed drivers/pwm/pwm-lpss.c drivers/hwmon/nct6775-core.c
> > and drivers/pwm/pwm-lpss.c
>
> drivers/pwm/pwm-lpss.c is addressed by
> https://lore.kernel.org/linux-pwm/cover.1733245406.git.ukleinek@kernel.org
>
> the hwmon driver is addressed by
> https://lore.kernel.org/linux-hwmon/20241203173149.1648456-2-u.kleine-koenig@baylibre.com
> (and applied in next)
>
> There is also drivers/gpio/gpio-idio-16.c (which I guess you intended to
> list instead of the pwm driver twice), which I sent a patch for at
> https://lore.kernel.org/linux-gpio/20241203172631.1647792-2-u.kleine-koenig@baylibre.com
> (also already applied in next).
With all those applied it is probably worth applying my change to export.h
(which is all I really wanted to do - until the build failures.)
diff --git a/include/linux/export.h b/include/linux/export.h
index 2633df4d31e6..6cea1c3982cd 100644
--- a/include/linux/export.h
+++ b/include/linux/export.h
@@ -59,14 +59,12 @@
#endif
-#ifdef DEFAULT_SYMBOL_NAMESPACE
-#define _EXPORT_SYMBOL(sym, license) __EXPORT_SYMBOL(sym, license, DEFAULT_SYMBOL_NAMESPACE)
-#else
-#define _EXPORT_SYMBOL(sym, license) __EXPORT_SYMBOL(sym, license, "")
+#ifndef DEFAULT_SYMBOL_NAMESPACE
+#define DEFAULT_SYMBOL_NAMESPACE ""
#endif
-#define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
-#define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "GPL")
+#define EXPORT_SYMBOL(sym) __EXPORT_SYMBOL(sym, "", DEFAULT_SYMBOL_NAMESPACE)
+#define EXPORT_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "GPL", DEFAULT_SYMBOL_NAMESPACE)
#define EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL(sym, "", ns)
#define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, "GPL", ns)
It would be 'nice' to get that into 6.13 (along with the other changes that
remove __stringify()) - but it is getting late in the rc cycle now.
Whether it is better to define DEFAULT_SYMBOL_NAMESPACE at the top of the
file or after the includes is another matter.
If the file is a module then it really makes sense to put the definition
with all the other module-related definitions.
The fact that it needs a #undef is annoying, but not the end of the world.
David
next prev parent reply other threads:[~2024-12-30 12:03 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
2024-12-30 9:42 ` Uwe Kleine-König
2024-12-30 12:03 ` David Laight [this message]
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=20241230120303.691e7a5c@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.