diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2009-02-06 00:33:09 -0500 |
|---|---|---|
| committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-02-22 18:48:53 -0500 |
| commit | 17be5b3ddf71d980f67fc826e49b00cd2afd724d (patch) | |
| tree | 1b6f06b4c119303ff77bef5f6e213d95cc2e5f63 | |
| parent | 44e1d064b919cb3a56ef67e0f7e244927be8369a (diff) | |
powerpc, ftrace: fix compile error when modules not configured
Michael Neuling reported a compile bug when dynamic ftrace was
configured in and modules were not. This was due to the ftrace
code referencing module specific structures.
Reported-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
| -rw-r--r-- | arch/powerpc/kernel/ftrace.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c index 77a7d186db1c..4112175183d3 100644 --- a/arch/powerpc/kernel/ftrace.c +++ b/arch/powerpc/kernel/ftrace.c | |||
| @@ -113,6 +113,8 @@ static int test_24bit_addr(unsigned long ip, unsigned long addr) | |||
| 113 | return create_branch((unsigned int *)ip, addr, 0); | 113 | return create_branch((unsigned int *)ip, addr, 0); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | #ifdef CONFIG_MODULES | ||
| 117 | |||
| 116 | static int is_bl_op(unsigned int op) | 118 | static int is_bl_op(unsigned int op) |
| 117 | { | 119 | { |
| 118 | return (op & 0xfc000003) == 0x48000001; | 120 | return (op & 0xfc000003) == 0x48000001; |
| @@ -324,6 +326,7 @@ __ftrace_make_nop(struct module *mod, | |||
| 324 | return 0; | 326 | return 0; |
| 325 | } | 327 | } |
| 326 | #endif /* PPC64 */ | 328 | #endif /* PPC64 */ |
| 329 | #endif /* CONFIG_MODULES */ | ||
| 327 | 330 | ||
| 328 | int ftrace_make_nop(struct module *mod, | 331 | int ftrace_make_nop(struct module *mod, |
| 329 | struct dyn_ftrace *rec, unsigned long addr) | 332 | struct dyn_ftrace *rec, unsigned long addr) |
| @@ -343,6 +346,7 @@ int ftrace_make_nop(struct module *mod, | |||
| 343 | return ftrace_modify_code(ip, old, new); | 346 | return ftrace_modify_code(ip, old, new); |
| 344 | } | 347 | } |
| 345 | 348 | ||
| 349 | #ifdef CONFIG_MODULES | ||
| 346 | /* | 350 | /* |
| 347 | * Out of range jumps are called from modules. | 351 | * Out of range jumps are called from modules. |
| 348 | * We should either already have a pointer to the module | 352 | * We should either already have a pointer to the module |
| @@ -367,9 +371,13 @@ int ftrace_make_nop(struct module *mod, | |||
| 367 | mod = rec->arch.mod; | 371 | mod = rec->arch.mod; |
| 368 | 372 | ||
| 369 | return __ftrace_make_nop(mod, rec, addr); | 373 | return __ftrace_make_nop(mod, rec, addr); |
| 370 | 374 | #else | |
| 375 | /* We should not get here without modules */ | ||
| 376 | return -EINVAL; | ||
| 377 | #endif /* CONFIG_MODULES */ | ||
| 371 | } | 378 | } |
| 372 | 379 | ||
| 380 | #ifdef CONFIG_MODULES | ||
| 373 | #ifdef CONFIG_PPC64 | 381 | #ifdef CONFIG_PPC64 |
| 374 | static int | 382 | static int |
| 375 | __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | 383 | __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) |
| @@ -458,6 +466,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
| 458 | return 0; | 466 | return 0; |
| 459 | } | 467 | } |
| 460 | #endif /* CONFIG_PPC64 */ | 468 | #endif /* CONFIG_PPC64 */ |
| 469 | #endif /* CONFIG_MODULES */ | ||
| 461 | 470 | ||
| 462 | int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | 471 | int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) |
| 463 | { | 472 | { |
| @@ -476,6 +485,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
| 476 | return ftrace_modify_code(ip, old, new); | 485 | return ftrace_modify_code(ip, old, new); |
| 477 | } | 486 | } |
| 478 | 487 | ||
| 488 | #ifdef CONFIG_MODULES | ||
| 479 | /* | 489 | /* |
| 480 | * Out of range jumps are called from modules. | 490 | * Out of range jumps are called from modules. |
| 481 | * Being that we are converting from nop, it had better | 491 | * Being that we are converting from nop, it had better |
| @@ -487,6 +497,10 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
| 487 | } | 497 | } |
| 488 | 498 | ||
| 489 | return __ftrace_make_call(rec, addr); | 499 | return __ftrace_make_call(rec, addr); |
| 500 | #else | ||
| 501 | /* We should not get here without modules */ | ||
| 502 | return -EINVAL; | ||
| 503 | #endif /* CONFIG_MODULES */ | ||
| 490 | } | 504 | } |
| 491 | 505 | ||
| 492 | int ftrace_update_ftrace_func(ftrace_func_t func) | 506 | int ftrace_update_ftrace_func(ftrace_func_t func) |
