Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932103AbbHZEHb (ORCPT ); Wed, 26 Aug 2015 00:07:31 -0400 Received: from ozlabs.org ([103.22.144.67]:44443 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752644AbbHZEHa (ORCPT ); Wed, 26 Aug 2015 00:07:30 -0400 From: Rusty Russell To: Paul Gortmaker , linux-kernel@vger.kernel.org Cc: Paul Gortmaker Subject: Re: [PATCH] kernel: make module.c itself more explicitly non-modular In-Reply-To: <1440555155-11273-1-git-send-email-paul.gortmaker@windriver.com> References: <1440555155-11273-1-git-send-email-paul.gortmaker@windriver.com> User-Agent: Notmuch/0.17 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Wed, 26 Aug 2015 13:36:55 +0930 Message-ID: <87mvxeitgg.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2500 Lines: 68 Paul Gortmaker writes: > The Kconfig currently controlling compilation of this code is: > > menuconfig MODULES > bool "Enable loadable module support" > > ...meaning that it currently is not being built as a module by anyone. > No surprise here, since modular support being a module would be an > interesting chicken before the egg problem. > > Lets remove the use of module_init in this code so that when reading > the file, there is less doubt that it is builtin-only. > > Since module_init translates to device_initcall in the non-modular > case, the init ordering remains unchanged with this commit. However > one could argue that fs_initcall makes more sense for proc stuff, > and we can change the initcall order later and watch for fallout > if so desired. This patch is just weird; is this part of something larger you are trying to do? I would argue that module_init() should be the default; it implies no dependencies on the initialization, and it's a common pattern. Cheers, Rusty. > We can't of course delete the module.h include in this case since it > is used all through the rest of the file. > > Cc: Rusty Russell > Signed-off-by: Paul Gortmaker > --- > > [I was undecided as to whether we should do this in one step > or two, i.e. instead just make the change to fs_initcall here > and now, and so went with the more cautious/granular approach.] > > kernel/module.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/module.c b/kernel/module.c > index 8f051a106676..7750bdcb12fc 100644 > --- a/kernel/module.c > +++ b/kernel/module.c > @@ -3947,7 +3947,7 @@ static int __init proc_modules_init(void) > proc_create("modules", 0, NULL, &proc_modules_operations); > return 0; > } > -module_init(proc_modules_init); > +device_initcall(proc_modules_init); > #endif > > /* Given an address, look for it in the module exception tables. */ > -- > 2.5.0 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/