thinkpad-acpi: make drivers/misc/thinkpad_acpi:fan_mutex static
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / kallsyms.h
blob1cebcbc28b474d9f7af1d4061f0e30ba60347aa8
1 /* Rewritten and vastly simplified by Rusty Russell for in-kernel
2 * module loader:
3 * Copyright 2002 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation
4 */
5 #ifndef _LINUX_KALLSYMS_H
6 #define _LINUX_KALLSYMS_H
9 #define KSYM_NAME_LEN 127
11 #ifdef CONFIG_KALLSYMS
12 /* Lookup the address for a symbol. Returns 0 if not found. */
13 unsigned long kallsyms_lookup_name(const char *name);
15 extern int kallsyms_lookup_size_offset(unsigned long addr,
16 unsigned long *symbolsize,
17 unsigned long *offset);
19 /* Lookup an address. modname is set to NULL if it's in the kernel. */
20 const char *kallsyms_lookup(unsigned long addr,
21 unsigned long *symbolsize,
22 unsigned long *offset,
23 char **modname, char *namebuf);
25 /* Replace "%s" in format with address, if found */
26 extern void __print_symbol(const char *fmt, unsigned long address);
28 #else /* !CONFIG_KALLSYMS */
30 static inline unsigned long kallsyms_lookup_name(const char *name)
32 return 0;
35 static inline int kallsyms_lookup_size_offset(unsigned long addr,
36 unsigned long *symbolsize,
37 unsigned long *offset)
39 return 0;
42 static inline const char *kallsyms_lookup(unsigned long addr,
43 unsigned long *symbolsize,
44 unsigned long *offset,
45 char **modname, char *namebuf)
47 return NULL;
50 /* Stupid that this does nothing, but I didn't create this mess. */
51 #define __print_symbol(fmt, addr)
52 #endif /*CONFIG_KALLSYMS*/
54 /* This macro allows us to keep printk typechecking */
55 static void __check_printsym_format(const char *fmt, ...)
56 __attribute__((format(printf,1,2)));
57 static inline void __check_printsym_format(const char *fmt, ...)
60 /* ia64 and ppc64 use function descriptors, which contain the real address */
61 #if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
62 #define print_fn_descriptor_symbol(fmt, addr) \
63 do { \
64 unsigned long *__faddr = (unsigned long*) addr; \
65 print_symbol(fmt, __faddr[0]); \
66 } while (0)
67 #else
68 #define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr)
69 #endif
71 static inline void print_symbol(const char *fmt, unsigned long addr)
73 __check_printsym_format(fmt, "");
74 __print_symbol(fmt, (unsigned long)
75 __builtin_extract_return_addr((void *)addr));
78 #ifndef CONFIG_64BIT
79 #define print_ip_sym(ip) \
80 do { \
81 printk("[<%08lx>]", ip); \
82 print_symbol(" %s\n", ip); \
83 } while(0)
84 #else
85 #define print_ip_sym(ip) \
86 do { \
87 printk("[<%016lx>]", ip); \
88 print_symbol(" %s\n", ip); \
89 } while(0)
90 #endif
92 #endif /*_LINUX_KALLSYMS_H*/