Re: [PATCH] kernel/module: fix warning when !CONFIG_DYNAMIC_PRINTK_DEBUG

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Greg KH
Date: Wednesday, August 20, 2008 - 8:13 am

On Wed, Aug 20, 2008 at 07:24:53AM -0700, Greg KH wrote:

I'll merge in this patch below, unless someone objects.

thanks,

greg k-h

---
 kernel/module.c |   54 ++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 34 insertions(+), 20 deletions(-)

--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1778,12 +1778,44 @@ static void add_kallsyms(struct module *
 static inline void add_kallsyms(struct module *mod,
 				Elf_Shdr *sechdrs,
 				unsigned int symindex,
-				unsigned int strindex,
 				const char *secstrings)
 {
 }
 #endif /* CONFIG_KALLSYMS */
 
+#ifdef CONFIG_DYNAMIC_PRINTK_DEBUG
+static void dynamic_printk_setup(struct module *mod,
+				 Elf_Shdr *sechdrs,
+				 unsigned int verboseindex,
+				 const char *secstrings)
+{
+	struct mod_debug *iter;
+	unsigned long value;
+
+	mod->start_verbose = (void *)sechdrs[verboseindex].sh_addr;
+	mod->num_verbose = sechdrs[verboseindex].sh_size /
+				sizeof(*mod->start_verbose);
+
+	for (value = (unsigned long)mod->start_verbose;
+		value < (unsigned long)mod->start_verbose +
+		(unsigned long)(mod->num_verbose * sizeof(struct mod_debug));
+		value += sizeof(struct mod_debug)) {
+			iter = (struct mod_debug *)value;
+			register_dynamic_debug_module(iter->modname,
+				iter->type,
+				iter->logical_modname,
+				iter->flag_names, iter->hash, iter->hash2);
+	}
+}
+#else
+static inline void dynamic_printk_setup(struct module *mod,
+					Elf_Shdr *sechdrs,
+					unsigned int symindex,
+					const char *secstrings)
+{
+}
+#endif /* CONFIG_DYNAMIC_PRINTK_DEBUG */
+
 static void *module_alloc_update_bounds(unsigned long size)
 {
 	void *ret = module_alloc(size);
@@ -1833,8 +1865,6 @@ static struct module *load_module(void _
 	unsigned int markersindex;
 	unsigned int markersstringsindex;
 	unsigned int verboseindex;
-	struct mod_debug *iter;
-	unsigned long value;
 	struct module *mod;
 	long err = 0;
 	void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */
@@ -2149,11 +2179,6 @@ static struct module *load_module(void _
 	mod->num_markers =
 		sechdrs[markersindex].sh_size / sizeof(*mod->markers);
 #endif
-#ifdef CONFIG_DYNAMIC_PRINTK_DEBUG
-	mod->start_verbose = (void *)sechdrs[verboseindex].sh_addr;
-	mod->num_verbose = sechdrs[verboseindex].sh_size /
-				sizeof(*mod->start_verbose);
-#endif
 
         /* Find duplicate symbols */
 	err = verify_export_symbols(mod);
@@ -2177,18 +2202,7 @@ static struct module *load_module(void _
 		marker_update_probe_range(mod->markers,
 			mod->markers + mod->num_markers);
 #endif
-#ifdef CONFIG_DYNAMIC_PRINTK_DEBUG
-	for (value = (unsigned long)mod->start_verbose;
-		value < (unsigned long)mod->start_verbose +
-		(unsigned long)(mod->num_verbose * sizeof(struct mod_debug));
-		value += sizeof(struct mod_debug)) {
-			iter = (struct mod_debug *)value;
-			register_dynamic_debug_module(iter->modname,
-				iter->type,
-				iter->logical_modname,
-				iter->flag_names, iter->hash, iter->hash2);
-	}
-#endif
+	dynamic_printk_setup(mod, sechdrs, verboseindex, secstrings);
 	err = module_finalize(hdr, sechdrs, mod);
 	if (err < 0)
 		goto cleanup;
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] kernel/module: fix warning when !CONFIG_DYNAMIC_PR ..., Alexander Beregalov, (Wed Aug 20, 7:13 am)
Re: [PATCH] kernel/module: fix warning when !CONFIG_DYNAMI ..., Greg KH, (Wed Aug 20, 8:13 am)