diff options
author | Peter Zijlstra <peterz@infradead.org> | 2015-05-26 21:39:37 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2015-05-27 22:02:08 -0400 |
commit | b7df4d1b23bfca830f1076412d21524686c5a441 (patch) | |
tree | cd496160a6e3b493bb8d508e910a84eeb4ac6a09 | |
parent | 6c9692e2d6a2206d8fd75ea247daa47fb75e4a02 (diff) |
module: Use __module_address() for module_address_lookup()
Use the generic __module_address() addr to struct module lookup
instead of open coding it once more.
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | kernel/module.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/kernel/module.c b/kernel/module.c index ac3044ceca3f..293dfaf4ce52 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -3671,19 +3671,15 @@ const char *module_address_lookup(unsigned long addr, | |||
3671 | char **modname, | 3671 | char **modname, |
3672 | char *namebuf) | 3672 | char *namebuf) |
3673 | { | 3673 | { |
3674 | struct module *mod; | ||
3675 | const char *ret = NULL; | 3674 | const char *ret = NULL; |
3675 | struct module *mod; | ||
3676 | 3676 | ||
3677 | preempt_disable(); | 3677 | preempt_disable(); |
3678 | list_for_each_entry_rcu(mod, &modules, list) { | 3678 | mod = __module_address(addr); |
3679 | if (mod->state == MODULE_STATE_UNFORMED) | 3679 | if (mod) { |
3680 | continue; | 3680 | if (modname) |
3681 | if (within_module(addr, mod)) { | 3681 | *modname = mod->name; |
3682 | if (modname) | 3682 | ret = get_ksymbol(mod, addr, size, offset); |
3683 | *modname = mod->name; | ||
3684 | ret = get_ksymbol(mod, addr, size, offset); | ||
3685 | break; | ||
3686 | } | ||
3687 | } | 3683 | } |
3688 | /* Make a copy in here where it's safe */ | 3684 | /* Make a copy in here where it's safe */ |
3689 | if (ret) { | 3685 | if (ret) { |
@@ -3691,6 +3687,7 @@ const char *module_address_lookup(unsigned long addr, | |||
3691 | ret = namebuf; | 3687 | ret = namebuf; |
3692 | } | 3688 | } |
3693 | preempt_enable(); | 3689 | preempt_enable(); |
3690 | |||
3694 | return ret; | 3691 | return ret; |
3695 | } | 3692 | } |
3696 | 3693 | ||