2015-07-20 04:57:15

by Minfei Huang

[permalink] [raw]
Subject: [PATCH] Fix compiling error once merge define-kallsyms_cmp_symbol_t-as-function-type-to-simplify-the-code

Code will fail to be compiled, once it is merged the patch
5ed0a999616a050af1268a99cc442fd0824a2b07(Define kallsyms_cmp_symbol_t
as function type to simplify the code).

The root cause which fails to compile is I included the linux/module.h
head file to linux/kallsyms.h. Now I write the patch to fix this issue,
and it passes on platform s390, x86_64, i386, etc..

In file included from arch/s390/include/asm/elf.h:130:0,
from include/linux/elf.h:4,
from include/linux/module.h:14,
from include/linux/kallsyms.h:11,
from kernel/sched/auto_group.c:5:
>> arch/s390/include/asm/mmu_context.h:80:0: warning: "finish_arch_post_lock_switch" redefined
#define finish_arch_post_lock_switch finish_arch_post_lock_switch
^
In file included from kernel/sched/auto_group.c:1:0:
kernel/sched/sched.h:1072:0: note: this is the location of the previous definition
# define finish_arch_post_lock_switch() do { } while (0)
^

Signed-off-by: Minfei Huang <[email protected]>
---
include/linux/kallsyms.h | 4 +++-
include/linux/module.h | 4 +---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index e8ed37d..d48bfa3 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -8,7 +8,6 @@
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
-#include <linux/module.h>

#define KSYM_NAME_LEN 128
#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
@@ -16,6 +15,9 @@

struct module;

+typedef int (*kallsyms_cmp_symbol_t)(void *, const char *,
+ struct module *, unsigned long);
+
#ifdef CONFIG_KALLSYMS
/* Lookup the address for a symbol. Returns 0 if not found. */
unsigned long kallsyms_lookup_name(const char *name);
diff --git a/include/linux/module.h b/include/linux/module.h
index 848f084..6015912 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -22,6 +22,7 @@

#include <linux/percpu.h>
#include <asm/module.h>
+#include <linux/kallsyms.h>

/* In stripped ARM and x86-64 modules, ~ is surprisingly rare. */
#define MODULE_SIG_STRING "~Module signature appended~\n"
@@ -273,9 +274,6 @@ const struct exception_table_entry *search_exception_tables(unsigned long add);

struct notifier_block;

-typedef int (*kallsyms_cmp_symbol_t)(void *, const char *,
- struct module *, unsigned long);
-
#ifdef CONFIG_MODULES

extern int modules_disabled; /* for sysctl */
--
2.2.2