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>
This commit is contained in:
parent
6c9692e2d6
commit
b7df4d1b23
|
@ -3671,19 +3671,15 @@ const char *module_address_lookup(unsigned long addr,
|
||||||
char **modname,
|
char **modname,
|
||||||
char *namebuf)
|
char *namebuf)
|
||||||
{
|
{
|
||||||
struct module *mod;
|
|
||||||
const char *ret = NULL;
|
const char *ret = NULL;
|
||||||
|
struct module *mod;
|
||||||
|
|
||||||
preempt_disable();
|
preempt_disable();
|
||||||
list_for_each_entry_rcu(mod, &modules, list) {
|
mod = __module_address(addr);
|
||||||
if (mod->state == MODULE_STATE_UNFORMED)
|
if (mod) {
|
||||||
continue;
|
if (modname)
|
||||||
if (within_module(addr, mod)) {
|
*modname = mod->name;
|
||||||
if (modname)
|
ret = get_ksymbol(mod, addr, size, offset);
|
||||||
*modname = mod->name;
|
|
||||||
ret = get_ksymbol(mod, addr, size, offset);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Make a copy in here where it's safe */
|
/* Make a copy in here where it's safe */
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -3691,6 +3687,7 @@ const char *module_address_lookup(unsigned long addr,
|
||||||
ret = namebuf;
|
ret = namebuf;
|
||||||
}
|
}
|
||||||
preempt_enable();
|
preempt_enable();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue