Subject: Re: [PATCH] modules: elide param_lock if !CONFIG_SYSFS

From: Stephen Rothwell <[email-masked]>
Date: Sat, 27 Jun 2015 10:21:34 +1000

Hi Rusty,

On Thu, 25 Jun 2015 17:34:31 -0400 Dan Streetman <[email-masked]> wrote:
>
> On Thu, Jun 25, 2015 at 5:18 PM, Rusty Russell <[email-masked]> wrote:
> > Dan Streetman <[email-masked]> writes:
> >> Only include the built-in and per-module param_lock, and corresponding
> >> lock/unlock functions, if sysfs is enabled.  If there is no sysfs there
> >> is no need for locking kernel params.
> >>
> >> This fixes a build break when CONFIG_SYSFS is not enabled, introduced
> >> by commit b51d23e.
> >
> > This doesn't even come close to applying to my tree?
> 
> sorry, I had the !CONFIG_MODULES patch in my tree also, so this was on
> top of that one:
> https://lkml.org/lkml/2015/6/24/550
> 
> I can resend that one, on top of this one, or you can fix it up.
> 
> Sorry for not getting it right the first time ;-)

This is what I ended up applying to yesterday's linux-next:

From: Stephen Rothwell <[email-masked]>
Date: Fri, 26 Jun 2015 13:19:19 +1000
Subject: [PATCH] modules: only use mod->param_lock if CONFIG_MODULES

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 kernel/params.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/params.c b/kernel/params.c
index faa461c16f12..adc0bbc06cc5 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -30,7 +30,11 @@
 static DEFINE_MUTEX(param_lock);
 
 /* Use the module's mutex, or if built-in use the built-in mutex */
+#ifdef CONFIG_MODULES
 #define KPARAM_MUTEX(mod)	((mod) ? &(mod)->param_lock : &param_lock)
+#else
+#define KPARAM_MUTEX(mod)	(&param_lock)
+#endif
 
 static inline void check_kparam_locked(struct module *mod)
 {
-- 
2.1.4

-- 
Cheers,
Stephen Rothwell                    [email-masked]