Skip to contentSkip to conversation

module.h: simplify MODULE_IMPORT_NS

PATCH In review Greg Kroah-Hartman 2 participants 2 messages Apr 27, 2022 – Apr 28, 2022 Module support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 module.h: simplify MODULE_IMPORT_NS

In commit ca321ec74322 ("module.h: allow #define strings to work with MODULE_IMPORT_NS") I fixed up the MODULE_IMPORT_NS() macro to allow defined strings to work with it. Unfortunatly I did it in a two-stage process, when it could just be done with the __stringify() macro as pointed out by Masahiro Yamada.

Clean this up to only be one macro instead of two steps to achieve the same end result.

Fixes ca321ec74322 ("module.h: allow #define strings to work with MODULE_IMPORT_NS")
Cc Luis Chamberlain <[email protected]>
Cc Jessica Yu <[email protected]>
Cc Matthias Maennich <[email protected]>
---
 include/linux/module.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/module.h +1 -2
index 1e135fd5c076..d5e9066990ca 100644
@@ -290,8 +290,7 @@ extern typeof(name) __mod_##type##__##name##_device_table		\
  * files require multiple MODULE_FIRMWARE() specifiers */
 #define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware)
 
-#define _MODULE_IMPORT_NS(ns)	MODULE_INFO(import_ns, #ns)
-#define MODULE_IMPORT_NS(ns)	_MODULE_IMPORT_NS(ns)
+#define MODULE_IMPORT_NS(ns)	MODULE_INFO(import_ns, __stringify(ns))
 
 struct notifier_block;
 
Signature · 1 line
2.36.0
maintainer
#1 lore raw
Quoted 9 lines · Greg Kroah-Hartman

In commit ca321ec74322 ("module.h: allow #define strings to work with MODULE_IMPORT_NS") I fixed up the MODULE_IMPORT_NS() macro to allow defined strings to work with it. Unfortunatly I did it in a two-stage process, when it could just be done with the __stringify() macro as pointed out by Masahiro Yamada.

Clean this up to only be one macro instead of two steps to achieve the same end result.

Quoted 6 lines
Fixes ca321ec74322 ("module.h: allow #define strings to work with MODULE_IMPORT_NS")
Cc Luis Chamberlain <[email protected]>
Cc Jessica Yu <[email protected]>
Cc Matthias Maennich <[email protected]>

Thanks! Queued onto modules-testing. If no complaints come back I'll move it to modules-next shortly after that.

Luis