diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-15 20:50:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-15 20:50:37 -0400 |
commit | a442ac512f36981182e66a427ad05f449ff6593b (patch) | |
tree | 8a99f2f4cb7f66e816163068c0c2c709c1852ac6 | |
parent | 7371fd11a6e2aed99895db4f100940fa5022f7fe (diff) |
Clean up 'print_fn_descriptor_symbol()' types
Everybody wants to pass it a function pointer, and in fact, that is what
you _must_ pass it for it to make sense (since it knows that ia64 and
ppc64 use descriptors for function pointers and fetches the actual
address from there).
So don't make the argument be a 'unsigned long' and force everybody to
add a cast.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/base/power/main.c | 2 | ||||
-rw-r--r-- | drivers/pci/quirks.c | 3 | ||||
-rw-r--r-- | drivers/pnp/quirks.c | 3 | ||||
-rw-r--r-- | include/linux/kallsyms.h | 24 | ||||
-rw-r--r-- | init/main.c | 9 |
5 files changed, 20 insertions, 21 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 7b76fd3b93..45cc3d9eac 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -418,7 +418,7 @@ void __suspend_report_result(const char *function, void *fn, int ret) | |||
418 | { | 418 | { |
419 | if (ret) { | 419 | if (ret) { |
420 | printk(KERN_ERR "%s(): ", function); | 420 | printk(KERN_ERR "%s(): ", function); |
421 | print_fn_descriptor_symbol("%s() returns ", (unsigned long)fn); | 421 | print_fn_descriptor_symbol("%s returns ", fn); |
422 | printk("%d\n", ret); | 422 | printk("%d\n", ret); |
423 | } | 423 | } |
424 | } | 424 | } |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index f2d9c770f5..dabb563f51 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1503,8 +1503,7 @@ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_f | |||
1503 | (f->device == dev->device || f->device == (u16) PCI_ANY_ID)) { | 1503 | (f->device == dev->device || f->device == (u16) PCI_ANY_ID)) { |
1504 | #ifdef DEBUG | 1504 | #ifdef DEBUG |
1505 | dev_dbg(&dev->dev, "calling "); | 1505 | dev_dbg(&dev->dev, "calling "); |
1506 | print_fn_descriptor_symbol("%s()\n", | 1506 | print_fn_descriptor_symbol("%s\n", f->hook); |
1507 | (unsigned long) f->hook); | ||
1508 | #endif | 1507 | #endif |
1509 | f->hook(dev); | 1508 | f->hook(dev); |
1510 | } | 1509 | } |
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c index ffdb12a59c..e2b7de4cb0 100644 --- a/drivers/pnp/quirks.c +++ b/drivers/pnp/quirks.c | |||
@@ -331,8 +331,7 @@ void pnp_fixup_device(struct pnp_dev *dev) | |||
331 | continue; | 331 | continue; |
332 | #ifdef DEBUG | 332 | #ifdef DEBUG |
333 | dev_dbg(&dev->dev, "%s: calling ", f->id); | 333 | dev_dbg(&dev->dev, "%s: calling ", f->id); |
334 | print_fn_descriptor_symbol("%s\n", | 334 | print_fn_descriptor_symbol("%s\n", f->quirk_function); |
335 | (unsigned long) f->quirk_function); | ||
336 | #endif | 335 | #endif |
337 | f->quirk_function(dev); | 336 | f->quirk_function(dev); |
338 | } | 337 | } |
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index 82de2fb62c..00c1801099 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h | |||
@@ -83,16 +83,6 @@ __attribute__((format(printf,1,2))); | |||
83 | static inline void __check_printsym_format(const char *fmt, ...) | 83 | static inline void __check_printsym_format(const char *fmt, ...) |
84 | { | 84 | { |
85 | } | 85 | } |
86 | /* ia64 and ppc64 use function descriptors, which contain the real address */ | ||
87 | #if defined(CONFIG_IA64) || defined(CONFIG_PPC64) | ||
88 | #define print_fn_descriptor_symbol(fmt, addr) \ | ||
89 | do { \ | ||
90 | unsigned long *__faddr = (unsigned long*) addr; \ | ||
91 | print_symbol(fmt, __faddr[0]); \ | ||
92 | } while (0) | ||
93 | #else | ||
94 | #define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr) | ||
95 | #endif | ||
96 | 86 | ||
97 | static inline void print_symbol(const char *fmt, unsigned long addr) | 87 | static inline void print_symbol(const char *fmt, unsigned long addr) |
98 | { | 88 | { |
@@ -101,6 +91,20 @@ static inline void print_symbol(const char *fmt, unsigned long addr) | |||
101 | __builtin_extract_return_addr((void *)addr)); | 91 | __builtin_extract_return_addr((void *)addr)); |
102 | } | 92 | } |
103 | 93 | ||
94 | /* | ||
95 | * Pretty-print a function pointer. | ||
96 | * | ||
97 | * ia64 and ppc64 function pointers are really function descriptors, | ||
98 | * which contain a pointer the real address. | ||
99 | */ | ||
100 | static inline void print_fn_descriptor_symbol(const char *fmt, void *addr) | ||
101 | { | ||
102 | #if defined(CONFIG_IA64) || defined(CONFIG_PPC64) | ||
103 | addr = *(void **)addr; | ||
104 | #endif | ||
105 | print_symbol(fmt, (unsigned long)addr); | ||
106 | } | ||
107 | |||
104 | #ifndef CONFIG_64BIT | 108 | #ifndef CONFIG_64BIT |
105 | #define print_ip_sym(ip) \ | 109 | #define print_ip_sym(ip) \ |
106 | do { \ | 110 | do { \ |
diff --git a/init/main.c b/init/main.c index f406fefa62..c62215146a 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -706,8 +706,7 @@ static void __init do_initcalls(void) | |||
706 | int result; | 706 | int result; |
707 | 707 | ||
708 | if (initcall_debug) { | 708 | if (initcall_debug) { |
709 | print_fn_descriptor_symbol("calling %s()\n", | 709 | print_fn_descriptor_symbol("calling %s\n", *call); |
710 | (unsigned long) *call); | ||
711 | t0 = ktime_get(); | 710 | t0 = ktime_get(); |
712 | } | 711 | } |
713 | 712 | ||
@@ -717,8 +716,7 @@ static void __init do_initcalls(void) | |||
717 | t1 = ktime_get(); | 716 | t1 = ktime_get(); |
718 | delta = ktime_sub(t1, t0); | 717 | delta = ktime_sub(t1, t0); |
719 | 718 | ||
720 | print_fn_descriptor_symbol("initcall %s()", | 719 | print_fn_descriptor_symbol("initcall %s", *call); |
721 | (unsigned long) *call); | ||
722 | printk(" returned %d after %Ld msecs\n", result, | 720 | printk(" returned %d after %Ld msecs\n", result, |
723 | (unsigned long long) delta.tv64 >> 20); | 721 | (unsigned long long) delta.tv64 >> 20); |
724 | } | 722 | } |
@@ -737,8 +735,7 @@ static void __init do_initcalls(void) | |||
737 | local_irq_enable(); | 735 | local_irq_enable(); |
738 | } | 736 | } |
739 | if (msgbuf[0]) { | 737 | if (msgbuf[0]) { |
740 | print_fn_descriptor_symbol(KERN_WARNING "initcall %s()", | 738 | print_fn_descriptor_symbol(KERN_WARNING "initcall %s", *call); |
741 | (unsigned long) *call); | ||
742 | printk(" returned with %s\n", msgbuf); | 739 | printk(" returned with %s\n", msgbuf); |
743 | } | 740 | } |
744 | } | 741 | } |