summaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-01-30 16:56:20 +0100
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-01-30 17:20:52 +0100
commit0d2a636ee6c3b8c292fbaae05976fe1537b70958 (patch)
tree6c77f15a0b2d9db1a4f1a19a0e741c0c02e40cd4 /scripts/mod/modpost.c
parentbbd3f4fb84f8c4a04f22c9c6dc119b0c4856c7d9 (diff)
downloadop-kernel-dev-0d2a636ee6c3b8c292fbaae05976fe1537b70958.zip
op-kernel-dev-0d2a636ee6c3b8c292fbaae05976fe1537b70958.tar.gz
modpost: pass around const struct sectioncheck * instead of enum mismatch
This prepares having a per-check whitelist of symbol names. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r--scripts/mod/modpost.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 598d54a..3f0380b 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -933,7 +933,8 @@ const struct sectioncheck sectioncheck[] = {
}
};
-static int section_mismatch(const char *fromsec, const char *tosec)
+static const struct sectioncheck *section_mismatch(
+ const char *fromsec, const char *tosec)
{
int i;
int elems = sizeof(sectioncheck) / sizeof(struct sectioncheck);
@@ -942,10 +943,10 @@ static int section_mismatch(const char *fromsec, const char *tosec)
for (i = 0; i < elems; i++) {
if (match(fromsec, check->fromsec) &&
match(tosec, check->tosec))
- return check->mismatch;
+ return check;
check++;
}
- return NO_MISMATCH;
+ return NULL;
}
/**
@@ -1158,7 +1159,8 @@ static int is_function(Elf_Sym *sym)
* Try to find symbols near it so user can find it.
* Check whitelist before warning - it may be a false positive.
*/
-static void report_sec_mismatch(const char *modname, enum mismatch mismatch,
+static void report_sec_mismatch(const char *modname,
+ const struct sectioncheck *mismatch,
const char *fromsec,
unsigned long long fromaddr,
const char *fromsym,
@@ -1189,7 +1191,7 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch,
modname, fromsec, fromaddr, from, fromsym, from_p, to, tosec,
tosym, to_p);
- switch (mismatch) {
+ switch (mismatch->mismatch) {
case TEXT_TO_ANY_INIT:
fprintf(stderr,
"The function %s%s() references\n"
@@ -1289,11 +1291,11 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf,
Elf_Rela *r, Elf_Sym *sym, const char *fromsec)
{
const char *tosec;
- enum mismatch mismatch;
+ const struct sectioncheck *mismatch;
tosec = sec_name(elf, sym->st_shndx);
mismatch = section_mismatch(fromsec, tosec);
- if (mismatch != NO_MISMATCH) {
+ if (mismatch) {
Elf_Sym *to;
Elf_Sym *from;
const char *tosym;
OpenPOWER on IntegriCloud