linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] module: make __mod_device_table__* symbols static
@ 2025-06-02 10:55 Masahiro Yamada
  2025-06-04  8:50 ` Petr Pavlu
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2025-06-02 10:55 UTC (permalink / raw)
  To: linux-kbuild
  Cc: linux-kernel, Masahiro Yamada, Daniel Gomez, Luis Chamberlain,
	Petr Pavlu, Sami Tolvanen, linux-modules

The __mod_device_table__* symbols are only parsed by modpost to generate
MODULE_ALIAS() entries from MODULE_DEVICE_TABLE().

Therefore, these symbols do not need to be globally visible, or globally
unique.

If they are in the global scope, we would worry about the symbol
uniqueness, but modpost is fine with parsing multiple symbols with the
same name.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 include/linux/module.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index 8050f77c3b64..92e1420fccdf 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -249,8 +249,8 @@ struct module_kobject *lookup_or_create_module_kobject(const char *name);
 #ifdef MODULE
 /* Creates an alias so file2alias.c can find device table. */
 #define MODULE_DEVICE_TABLE(type, name)					\
-extern typeof(name) __mod_device_table__##type##__##name		\
-  __attribute__ ((unused, alias(__stringify(name))))
+static typeof(name) __mod_device_table__##type##__##name		\
+  __attribute__ ((used, alias(__stringify(name))))
 #else  /* !MODULE */
 #define MODULE_DEVICE_TABLE(type, name)
 #endif
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] module: make __mod_device_table__* symbols static
  2025-06-02 10:55 [PATCH] module: make __mod_device_table__* symbols static Masahiro Yamada
@ 2025-06-04  8:50 ` Petr Pavlu
  2025-06-05 20:26   ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Pavlu @ 2025-06-04  8:50 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, linux-kernel, Daniel Gomez, Luis Chamberlain,
	Sami Tolvanen, linux-modules

On 6/2/25 12:55 PM, Masahiro Yamada wrote:
> The __mod_device_table__* symbols are only parsed by modpost to generate
> MODULE_ALIAS() entries from MODULE_DEVICE_TABLE().
> 
> Therefore, these symbols do not need to be globally visible, or globally
> unique.
> 
> If they are in the global scope, we would worry about the symbol
> uniqueness, but modpost is fine with parsing multiple symbols with the
> same name.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Reviewed-by: Petr Pavlu <petr.pavlu@suse.com>

-- 
Thanks,
Petr

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] module: make __mod_device_table__* symbols static
  2025-06-04  8:50 ` Petr Pavlu
@ 2025-06-05 20:26   ` Masahiro Yamada
  0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2025-06-05 20:26 UTC (permalink / raw)
  To: Petr Pavlu
  Cc: linux-kbuild, linux-kernel, Daniel Gomez, Luis Chamberlain,
	Sami Tolvanen, linux-modules

On Wed, Jun 4, 2025 at 5:50 PM Petr Pavlu <petr.pavlu@suse.com> wrote:
>
> On 6/2/25 12:55 PM, Masahiro Yamada wrote:
> > The __mod_device_table__* symbols are only parsed by modpost to generate
> > MODULE_ALIAS() entries from MODULE_DEVICE_TABLE().
> >
> > Therefore, these symbols do not need to be globally visible, or globally
> > unique.
> >
> > If they are in the global scope, we would worry about the symbol
> > uniqueness, but modpost is fine with parsing multiple symbols with the
> > same name.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
>
> Reviewed-by: Petr Pavlu <petr.pavlu@suse.com>
>
> --
> Thanks,
> Petr
>


Applied to linux-kbuild

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-05 20:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-02 10:55 [PATCH] module: make __mod_device_table__* symbols static Masahiro Yamada
2025-06-04  8:50 ` Petr Pavlu
2025-06-05 20:26   ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).