From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753372AbbB1Vjd (ORCPT ); Sat, 28 Feb 2015 16:39:33 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:38967 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753136AbbB1ViW (ORCPT ); Sat, 28 Feb 2015 16:38:22 -0500 Message-Id: <20150228213110.378339110@infradead.org> User-Agent: quilt/0.61-1 Date: Sat, 28 Feb 2015 22:24:56 +0100 From: Peter Zijlstra To: mingo@kernel.org, rusty@rustcorp.com.au, mathieu.desnoyers@efficios.com, oleg@redhat.com, paulmck@linux.vnet.ibm.com Cc: linux-kernel@vger.kernel.org, andi@firstfloor.org, rostedt@goodmis.org, tglx@linutronix.de, peterz@infradead.org Subject: [RFC][PATCH 9/9] module: Use __module_address() for module_address_lookup() References: <20150228212447.381543289@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=peterz-module-use-__module_address.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the generic __module_address() addr to struct module lookup instead of open coding it once more. Cc: Rusty Russell Signed-off-by: Peter Zijlstra (Intel) --- kernel/module.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) --- a/kernel/module.c +++ b/kernel/module.c @@ -3515,19 +3515,15 @@ const char *module_address_lookup(unsign char **modname, char *namebuf) { - struct module *mod; const char *ret = NULL; + struct module *mod; preempt_disable(); - list_for_each_entry_rcu(mod, &modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) - continue; - if (within_module(addr, mod)) { - if (modname) - *modname = mod->name; - ret = get_ksymbol(mod, addr, size, offset); - break; - } + mod = __module_address(addr); + if (mod) { + if (modname) + *modname = mod->name; + ret = get_ksymbol(mod, addr, size, offset); } /* Make a copy in here where it's safe */ if (ret) { @@ -3535,6 +3531,7 @@ const char *module_address_lookup(unsign ret = namebuf; } preempt_enable(); + return ret; }