Commit 5e12416927975aa3c58394cea15db6c3e488a033

Authored by Jim Cromie
Committed by Rusty Russell
1 parent bd77c04772

module: replace DEBUGP with pr_debug

Use more flexible pr_debug.  This allows:

  echo "module module +p" > /dbg/dynamic_debug/control

to turn on debug messages when needed.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Showing 1 changed file with 20 additions and 26 deletions Side-by-side Diff

... ... @@ -62,12 +62,6 @@
62 62 #define CREATE_TRACE_POINTS
63 63 #include <trace/events/module.h>
64 64  
65   -#if 0
66   -#define DEBUGP printk
67   -#else
68   -#define DEBUGP(fmt , a...)
69   -#endif
70   -
71 65 #ifndef ARCH_SHF_SMALL
72 66 #define ARCH_SHF_SMALL 0
73 67 #endif
... ... @@ -409,7 +403,7 @@
409 403 return fsa.sym;
410 404 }
411 405  
412   - DEBUGP("Failed to find symbol %s\n", name);
  406 + pr_debug("Failed to find symbol %s\n", name);
413 407 return NULL;
414 408 }
415 409 EXPORT_SYMBOL_GPL(find_symbol);
416 410  
... ... @@ -599,11 +593,11 @@
599 593  
600 594 list_for_each_entry(use, &b->source_list, source_list) {
601 595 if (use->source == a) {
602   - DEBUGP("%s uses %s!\n", a->name, b->name);
  596 + pr_debug("%s uses %s!\n", a->name, b->name);
603 597 return 1;
604 598 }
605 599 }
606   - DEBUGP("%s does not use %s!\n", a->name, b->name);
  600 + pr_debug("%s does not use %s!\n", a->name, b->name);
607 601 return 0;
608 602 }
609 603  
... ... @@ -618,7 +612,7 @@
618 612 {
619 613 struct module_use *use;
620 614  
621   - DEBUGP("Allocating new usage for %s.\n", a->name);
  615 + pr_debug("Allocating new usage for %s.\n", a->name);
622 616 use = kmalloc(sizeof(*use), GFP_ATOMIC);
623 617 if (!use) {
624 618 printk(KERN_WARNING "%s: out of memory loading\n", a->name);
... ... @@ -662,7 +656,7 @@
662 656 mutex_lock(&module_mutex);
663 657 list_for_each_entry_safe(use, tmp, &mod->target_list, target_list) {
664 658 struct module *i = use->target;
665   - DEBUGP("%s unusing %s\n", mod->name, i->name);
  659 + pr_debug("%s unusing %s\n", mod->name, i->name);
666 660 module_put(i);
667 661 list_del(&use->source_list);
668 662 list_del(&use->target_list);
... ... @@ -760,7 +754,7 @@
760 754 /* Since we might sleep for some time, release the mutex first */
761 755 mutex_unlock(&module_mutex);
762 756 for (;;) {
763   - DEBUGP("Looking at refcount...\n");
  757 + pr_debug("Looking at refcount...\n");
764 758 set_current_state(TASK_UNINTERRUPTIBLE);
765 759 if (module_refcount(mod) == 0)
766 760 break;
... ... @@ -803,7 +797,7 @@
803 797 if (mod->state != MODULE_STATE_LIVE) {
804 798 /* FIXME: if (force), slam module count and wake up
805 799 waiter --RR */
806   - DEBUGP("%s already dying\n", mod->name);
  800 + pr_debug("%s already dying\n", mod->name);
807 801 ret = -EBUSY;
808 802 goto out;
809 803 }
... ... @@ -1056,7 +1050,7 @@
1056 1050  
1057 1051 if (versions[i].crc == maybe_relocated(*crc, crc_owner))
1058 1052 return 1;
1059   - DEBUGP("Found checksum %lX vs module %lX\n",
  1053 + pr_debug("Found checksum %lX vs module %lX\n",
1060 1054 maybe_relocated(*crc, crc_owner), versions[i].crc);
1061 1055 goto bad_version;
1062 1056 }
... ... @@ -1833,7 +1827,7 @@
1833 1827 case SHN_COMMON:
1834 1828 /* We compiled with -fno-common. These are not
1835 1829 supposed to happen. */
1836   - DEBUGP("Common symbol: %s\n", name);
  1830 + pr_debug("Common symbol: %s\n", name);
1837 1831 printk("%s: please compile with -fno-common\n",
1838 1832 mod->name);
1839 1833 ret = -ENOEXEC;
... ... @@ -1841,7 +1835,7 @@
1841 1835  
1842 1836 case SHN_ABS:
1843 1837 /* Don't need to do anything */
1844   - DEBUGP("Absolute symbol: 0x%08lx\n",
  1838 + pr_debug("Absolute symbol: 0x%08lx\n",
1845 1839 (long)sym[i].st_value);
1846 1840 break;
1847 1841  
... ... @@ -1965,7 +1959,7 @@
1965 1959 for (i = 0; i < info->hdr->e_shnum; i++)
1966 1960 info->sechdrs[i].sh_entsize = ~0UL;
1967 1961  
1968   - DEBUGP("Core section allocation order:\n");
  1962 + pr_debug("Core section allocation order:\n");
1969 1963 for (m = 0; m < ARRAY_SIZE(masks); ++m) {
1970 1964 for (i = 0; i < info->hdr->e_shnum; ++i) {
1971 1965 Elf_Shdr *s = &info->sechdrs[i];
... ... @@ -1977,7 +1971,7 @@
1977 1971 || strstarts(sname, ".init"))
1978 1972 continue;
1979 1973 s->sh_entsize = get_offset(mod, &mod->core_size, s, i);
1980   - DEBUGP("\t%s\n", name);
  1974 + pr_debug("\t%s\n", sname);
1981 1975 }
1982 1976 switch (m) {
1983 1977 case 0: /* executable */
... ... @@ -1994,7 +1988,7 @@
1994 1988 }
1995 1989 }
1996 1990  
1997   - DEBUGP("Init section allocation order:\n");
  1991 + pr_debug("Init section allocation order:\n");
1998 1992 for (m = 0; m < ARRAY_SIZE(masks); ++m) {
1999 1993 for (i = 0; i < info->hdr->e_shnum; ++i) {
2000 1994 Elf_Shdr *s = &info->sechdrs[i];
... ... @@ -2007,7 +2001,7 @@
2007 2001 continue;
2008 2002 s->sh_entsize = (get_offset(mod, &mod->init_size, s, i)
2009 2003 | INIT_OFFSET_MASK);
2010   - DEBUGP("\t%s\n", sname);
  2004 + pr_debug("\t%s\n", sname);
2011 2005 }
2012 2006 switch (m) {
2013 2007 case 0: /* executable */
... ... @@ -2195,7 +2189,7 @@
2195 2189 symsect->sh_flags |= SHF_ALLOC;
2196 2190 symsect->sh_entsize = get_offset(mod, &mod->init_size, symsect,
2197 2191 info->index.sym) | INIT_OFFSET_MASK;
2198   - DEBUGP("\t%s\n", info->secstrings + symsect->sh_name);
  2192 + pr_debug("\t%s\n", info->secstrings + symsect->sh_name);
2199 2193  
2200 2194 src = (void *)info->hdr + symsect->sh_offset;
2201 2195 nsrc = symsect->sh_size / sizeof(*src);
... ... @@ -2216,7 +2210,7 @@
2216 2210 strsect->sh_flags |= SHF_ALLOC;
2217 2211 strsect->sh_entsize = get_offset(mod, &mod->init_size, strsect,
2218 2212 info->index.str) | INIT_OFFSET_MASK;
2219   - DEBUGP("\t%s\n", info->secstrings + strsect->sh_name);
  2213 + pr_debug("\t%s\n", info->secstrings + strsect->sh_name);
2220 2214 }
2221 2215  
2222 2216 static void add_kallsyms(struct module *mod, const struct load_info *info)
... ... @@ -2618,7 +2612,7 @@
2618 2612 mod->module_init = ptr;
2619 2613  
2620 2614 /* Transfer each section which specifies SHF_ALLOC */
2621   - DEBUGP("final section addresses:\n");
  2615 + pr_debug("final section addresses:\n");
2622 2616 for (i = 0; i < info->hdr->e_shnum; i++) {
2623 2617 void *dest;
2624 2618 Elf_Shdr *shdr = &info->sechdrs[i];
... ... @@ -2636,8 +2630,8 @@
2636 2630 memcpy(dest, (void *)shdr->sh_addr, shdr->sh_size);
2637 2631 /* Update sh_addr to point to copy in image. */
2638 2632 shdr->sh_addr = (unsigned long)dest;
2639   - DEBUGP("\t0x%lx %s\n",
2640   - shdr->sh_addr, info->secstrings + shdr->sh_name);
  2633 + pr_debug("\t0x%lx %s\n",
  2634 + (long)shdr->sh_addr, info->secstrings + shdr->sh_name);
2641 2635 }
2642 2636  
2643 2637 return 0;
... ... @@ -2798,7 +2792,7 @@
2798 2792 struct module *mod;
2799 2793 long err;
2800 2794  
2801   - DEBUGP("load_module: umod=%p, len=%lu, uargs=%p\n",
  2795 + pr_debug("load_module: umod=%p, len=%lu, uargs=%p\n",
2802 2796 umod, len, uargs);
2803 2797  
2804 2798 /* Copy in the blobs from userspace, check they are vaguely sane. */