Skip to contentSkip to conversation

kallsyms: restructure print_fn_descriptor_symbol

PATCH New Kyle McMartin 1 participant 1 message Apr 18, 2008 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 kallsyms: restructure print_fn_descriptor_symbol

Factor out the function descriptor access from the print_symbol call.

---
 include/linux/kallsyms.h |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
include/linux/kallsyms.h +10 -6
index 82de2fb..6734a3f 100644
@@ -83,17 +83,21 @@ __attribute__((format(printf,1,2)));
 static inline void __check_printsym_format(const char *fmt, ...)
 {
 }
+
 /* ia64 and ppc64 use function descriptors, which contain the real address */
 #if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
-#define print_fn_descriptor_symbol(fmt, addr)		\
-do {						\
-	unsigned long *__faddr = (unsigned long*) addr;		\
-	print_symbol(fmt, __faddr[0]);		\
-} while (0)
+#define get_func_addr(x)	({				\
+					unsigned long *addr =	\
+						(unsigned long *)x;	\
+					addr[0];		\
+				})
 #else
-#define print_fn_descriptor_symbol(fmt, addr) print_symbol(fmt, addr)
+#define get_func_addr(x)	x
 #endif
 
+#define print_fn_descriptor_symbol(fmt, addr)	\
+		print_symbol(fmt, get_func_addr(addr))
+
 static inline void print_symbol(const char *fmt, unsigned long addr)
 {
 	__check_printsym_format(fmt, "");
Signature · 1 line
1.5.4.5