linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] module: replace VMLINUX_SYMBOL_STR() with __stringify() or string literal
@ 2018-06-23 15:37 Masahiro Yamada
  2018-06-25  9:52 ` Jessica Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2018-06-23 15:37 UTC (permalink / raw)
  To: Jessica Yu; +Cc: Masahiro Yamada, linux-kernel

With the special case handling for Blackfin and Metag was removed by
commit 94e58e0ac312 ("export.h: remove code for prefixing symbols with
underscore"), VMLINUX_SYMBOL_STR() is now equivalent to __stringify().

Replace the remaining usages to prepare for the entire removal of
VMLINUX_SYMBOL_STR().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 include/linux/module.h | 4 ++--
 kernel/module.c        | 6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index d44df9b..f807f15 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -266,7 +266,7 @@ extern int modules_disabled; /* for sysctl */
 /* Get/put a kernel symbol (calls must be symmetric) */
 void *__symbol_get(const char *symbol);
 void *__symbol_get_gpl(const char *symbol);
-#define symbol_get(x) ((typeof(&x))(__symbol_get(VMLINUX_SYMBOL_STR(x))))
+#define symbol_get(x) ((typeof(&x))(__symbol_get(__stringify(x))))
 
 /* modules using other modules: kdb wants to see this. */
 struct module_use {
@@ -575,7 +575,7 @@ extern void __noreturn __module_put_and_exit(struct module *mod,
 #ifdef CONFIG_MODULE_UNLOAD
 int module_refcount(struct module *mod);
 void __symbol_put(const char *symbol);
-#define symbol_put(x) __symbol_put(VMLINUX_SYMBOL_STR(x))
+#define symbol_put(x) __symbol_put(__stringify(x))
 void symbol_put_addr(void *addr);
 
 /* Sometimes we know we already have a refcount, and it's easier not
diff --git a/kernel/module.c b/kernel/module.c
index f475f30..624d2c0 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1339,14 +1339,12 @@ static inline int check_modstruct_version(const struct load_info *info,
 	 * locking is necessary -- use preempt_disable() to placate lockdep.
 	 */
 	preempt_disable();
-	if (!find_symbol(VMLINUX_SYMBOL_STR(module_layout), NULL,
-			 &crc, true, false)) {
+	if (!find_symbol("module_layout", NULL, &crc, true, false)) {
 		preempt_enable();
 		BUG();
 	}
 	preempt_enable();
-	return check_version(info, VMLINUX_SYMBOL_STR(module_layout),
-			     mod, crc);
+	return check_version(info, "module_layout", mod, crc);
 }
 
 /* First part is kernel version, which we ignore if module has crcs. */
-- 
2.7.4


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

* Re: [PATCH] module: replace VMLINUX_SYMBOL_STR() with __stringify() or string literal
  2018-06-23 15:37 [PATCH] module: replace VMLINUX_SYMBOL_STR() with __stringify() or string literal Masahiro Yamada
@ 2018-06-25  9:52 ` Jessica Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Jessica Yu @ 2018-06-25  9:52 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kernel

+++ Masahiro Yamada [24/06/18 00:37 +0900]:
>With the special case handling for Blackfin and Metag was removed by
>commit 94e58e0ac312 ("export.h: remove code for prefixing symbols with
>underscore"), VMLINUX_SYMBOL_STR() is now equivalent to __stringify().
>
>Replace the remaining usages to prepare for the entire removal of
>VMLINUX_SYMBOL_STR().
>
>Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Applied, thanks.

Jessica

>---
>
> include/linux/module.h | 4 ++--
> kernel/module.c        | 6 ++----
> 2 files changed, 4 insertions(+), 6 deletions(-)
>
>diff --git a/include/linux/module.h b/include/linux/module.h
>index d44df9b..f807f15 100644
>--- a/include/linux/module.h
>+++ b/include/linux/module.h
>@@ -266,7 +266,7 @@ extern int modules_disabled; /* for sysctl */
> /* Get/put a kernel symbol (calls must be symmetric) */
> void *__symbol_get(const char *symbol);
> void *__symbol_get_gpl(const char *symbol);
>-#define symbol_get(x) ((typeof(&x))(__symbol_get(VMLINUX_SYMBOL_STR(x))))
>+#define symbol_get(x) ((typeof(&x))(__symbol_get(__stringify(x))))
>
> /* modules using other modules: kdb wants to see this. */
> struct module_use {
>@@ -575,7 +575,7 @@ extern void __noreturn __module_put_and_exit(struct module *mod,
> #ifdef CONFIG_MODULE_UNLOAD
> int module_refcount(struct module *mod);
> void __symbol_put(const char *symbol);
>-#define symbol_put(x) __symbol_put(VMLINUX_SYMBOL_STR(x))
>+#define symbol_put(x) __symbol_put(__stringify(x))
> void symbol_put_addr(void *addr);
>
> /* Sometimes we know we already have a refcount, and it's easier not
>diff --git a/kernel/module.c b/kernel/module.c
>index f475f30..624d2c0 100644
>--- a/kernel/module.c
>+++ b/kernel/module.c
>@@ -1339,14 +1339,12 @@ static inline int check_modstruct_version(const struct load_info *info,
> 	 * locking is necessary -- use preempt_disable() to placate lockdep.
> 	 */
> 	preempt_disable();
>-	if (!find_symbol(VMLINUX_SYMBOL_STR(module_layout), NULL,
>-			 &crc, true, false)) {
>+	if (!find_symbol("module_layout", NULL, &crc, true, false)) {
> 		preempt_enable();
> 		BUG();
> 	}
> 	preempt_enable();
>-	return check_version(info, VMLINUX_SYMBOL_STR(module_layout),
>-			     mod, crc);
>+	return check_version(info, "module_layout", mod, crc);
> }
>
> /* First part is kernel version, which we ignore if module has crcs. */
>-- 
>2.7.4
>

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

end of thread, other threads:[~2018-06-25  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-23 15:37 [PATCH] module: replace VMLINUX_SYMBOL_STR() with __stringify() or string literal Masahiro Yamada
2018-06-25  9:52 ` Jessica Yu

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).