[PATCH 3/7] dynamic debug v2 - convert module.c

From: Jason Baron
Date: Tue Jul 15 2008 - 17:34:36 EST



-convert DEBUGP calls to pr_debug module.c

Signed-off-by: Jason Baron <jbaron@xxxxxxxxxx>

---

kernel/module.c | 40 +++++++++++++++++-----------------------
1 files changed, 17 insertions(+), 23 deletions(-)


diff --git a/kernel/module.c b/kernel/module.c
index 5f36555..ae40845 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -47,12 +47,6 @@
#include <linux/license.h>
#include <asm/sections.h>

-#if 0
-#define DEBUGP printk
-#else
-#define DEBUGP(fmt , a...)
-#endif
-
#ifndef ARCH_SHF_SMALL
#define ARCH_SHF_SMALL 0
#endif
@@ -289,7 +283,7 @@ static unsigned long __find_symbol(const char *name,
return ks->value;
}
}
- DEBUGP("Failed to find symbol %s\n", name);
+ pr_debug("Failed to find symbol %s\n", name);
return -ENOENT;
}

@@ -538,11 +532,11 @@ static int already_uses(struct module *a, struct module *b)

list_for_each_entry(use, &b->modules_which_use_me, list) {
if (use->module_which_uses == a) {
- DEBUGP("%s uses %s!\n", a->name, b->name);
+ pr_debug("%s uses %s!\n", a->name, b->name);
return 1;
}
}
- DEBUGP("%s does not use %s!\n", a->name, b->name);
+ pr_debug("%s does not use %s!\n", a->name, b->name);
return 0;
}

@@ -567,7 +561,7 @@ static int use_module(struct module *a, struct module *b)
if (err)
return 0;

- DEBUGP("Allocating new usage for %s.\n", a->name);
+ pr_debug("Allocating new usage for %s.\n", a->name);
use = kmalloc(sizeof(*use), GFP_ATOMIC);
if (!use) {
printk("%s: out of memory loading\n", a->name);
@@ -591,7 +585,7 @@ static void module_unload_free(struct module *mod)

list_for_each_entry(use, &i->modules_which_use_me, list) {
if (use->module_which_uses == mod) {
- DEBUGP("%s unusing %s\n", mod->name, i->name);
+ pr_debug("%s unusing %s\n", mod->name, i->name);
module_put(i);
list_del(&use->list);
kfree(use);
@@ -666,7 +660,7 @@ static void wait_for_zero_refcount(struct module *mod)
/* Since we might sleep for some time, release the mutex first */
mutex_unlock(&module_mutex);
for (;;) {
- DEBUGP("Looking at refcount...\n");
+ pr_debug("Looking at refcount...\n");
set_current_state(TASK_UNINTERRUPTIBLE);
if (module_refcount(mod) == 0)
break;
@@ -709,7 +703,7 @@ sys_delete_module(const char __user *name_user, unsigned int flags)
if (mod->state != MODULE_STATE_LIVE) {
/* FIXME: if (force), slam module count and wake up
waiter --RR */
- DEBUGP("%s already dying\n", mod->name);
+ pr_debug("%s already dying\n", mod->name);
ret = -EBUSY;
goto out;
}
@@ -908,7 +902,7 @@ static int check_version(Elf_Shdr *sechdrs,
return 1;
printk("%s: disagrees about version of symbol %s\n",
mod->name, symname);
- DEBUGP("Found checksum %lX vs module %lX\n",
+ pr_debug("Found checksum %lX vs module %lX\n",
*crc, versions[i].crc);
return 0;
}
@@ -1430,7 +1424,7 @@ static int simplify_symbols(Elf_Shdr *sechdrs,
case SHN_COMMON:
/* We compiled with -fno-common. These are not
supposed to happen. */
- DEBUGP("Common symbol: %s\n", strtab + sym[i].st_name);
+ pr_debug("Common symbol: %s\n", strtab + sym[i].st_name);
printk("%s: please compile with -fno-common\n",
mod->name);
ret = -ENOEXEC;
@@ -1438,7 +1432,7 @@ static int simplify_symbols(Elf_Shdr *sechdrs,

case SHN_ABS:
/* Don't need to do anything */
- DEBUGP("Absolute symbol: 0x%08lx\n",
+ pr_debug("Absolute symbol: 0x%08lx\n",
(long)sym[i].st_value);
break;

@@ -1506,7 +1500,7 @@ static void layout_sections(struct module *mod,
for (i = 0; i < hdr->e_shnum; i++)
sechdrs[i].sh_entsize = ~0UL;

- DEBUGP("Core section allocation order:\n");
+ pr_debug("Core section allocation order:\n");
for (m = 0; m < ARRAY_SIZE(masks); ++m) {
for (i = 0; i < hdr->e_shnum; ++i) {
Elf_Shdr *s = &sechdrs[i];
@@ -1518,13 +1512,13 @@ static void layout_sections(struct module *mod,
".init", 5) == 0)
continue;
s->sh_entsize = get_offset(&mod->core_size, s);
- DEBUGP("\t%s\n", secstrings + s->sh_name);
+ pr_debug("\t%s\n", secstrings + s->sh_name);
}
if (m == 0)
mod->core_text_size = mod->core_size;
}

- DEBUGP("Init section allocation order:\n");
+ pr_debug("Init section allocation order:\n");
for (m = 0; m < ARRAY_SIZE(masks); ++m) {
for (i = 0; i < hdr->e_shnum; ++i) {
Elf_Shdr *s = &sechdrs[i];
@@ -1537,7 +1531,7 @@ static void layout_sections(struct module *mod,
continue;
s->sh_entsize = (get_offset(&mod->init_size, s)
| INIT_OFFSET_MASK);
- DEBUGP("\t%s\n", secstrings + s->sh_name);
+ pr_debug("\t%s\n", secstrings + s->sh_name);
}
if (m == 0)
mod->init_text_size = mod->init_size;
@@ -1727,7 +1721,7 @@ static struct module *load_module(void __user *umod,
struct exception_table_entry *extable;
mm_segment_t old_fs;

- DEBUGP("load_module: umod=%p, len=%lu, uargs=%p\n",
+ pr_debug("load_module: umod=%p, len=%lu, uargs=%p\n",
umod, len, uargs);
if (len < sizeof(*hdr))
return ERR_PTR(-ENOEXEC);
@@ -1902,7 +1896,7 @@ static struct module *load_module(void __user *umod,
mod->module_init = ptr;

/* Transfer each section which specifies SHF_ALLOC */
- DEBUGP("final section addresses:\n");
+ pr_debug("final section addresses:\n");
for (i = 0; i < hdr->e_shnum; i++) {
void *dest;

@@ -1920,7 +1914,7 @@ static struct module *load_module(void __user *umod,
sechdrs[i].sh_size);
/* Update sh_addr to point to copy in image. */
sechdrs[i].sh_addr = (unsigned long)dest;
- DEBUGP("\t0x%lx %s\n", sechdrs[i].sh_addr, secstrings + sechdrs[i].sh_name);
+ pr_debug("\t0x%lx %s\n", sechdrs[i].sh_addr, secstrings + sechdrs[i].sh_name);
}
/* Module has been moved. */
mod = (void *)sechdrs[modindex].sh_addr;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/