[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150423193339.GO5622@wotan.suse.de>
Date: Thu, 23 Apr 2015 21:33:39 +0200
From: "Luis R. Rodriguez" <mcgrof@...e.com>
To: Rusty Russell <rusty@...tcorp.com.au>,
Julia Lawall <julia.lawall@...6.fr>
Cc: "Luis R. Rodriguez" <mcgrof@...not-panic.com>,
akpm@...ux-foundation.org, mingo@...nel.org, tj@...nel.org,
linux-kernel@...r.kernel.org, linux-wireless@...r.kernel.org,
keescook@...omium.org, casey@...aufler-ca.com,
cocci@...teme.lip6.fr, Jani Nikula <jani.nikula@...el.com>
Subject: Re: [PATCH v2 4/8] moduleparam.h: add module_param_config_*() helpers
On Thu, Apr 23, 2015 at 11:45:09AM +0930, Rusty Russell wrote:
> "Luis R. Rodriguez" <mcgrof@...not-panic.com> writes:
> > From: "Luis R. Rodriguez" <mcgrof@...e.com>
> >
> > This adds a couple of bool module_param_config_*() helpers
> > which are designed to let us easily associate a boolean
> > module parameter with an associated kernel configuration
> > option.
>
> OK.
So this is really the main gain.
> > Folks can use this to avoid what typically would
> > be #ifdef eyesores around module parameter declarations.
>
> Really? So you use this in two patches:
>
> /* see the comment above the definition of WQ_POWER_EFFICIENT */
> -static bool wq_power_efficient = IS_ENABLED(CONFIG_WQ_POWER_EFFICIENT_DEFAULT);
> -module_param_named(power_efficient, wq_power_efficient, bool, 0444);
> +module_param_config_on_off(power_efficient, wq_power_efficient, 0444, CONFIG_WQ_POWER_EFFICIENT_DEFAULT);
>
> And:
>
> static bool sig_enforce = IS_ENABLED(CONFIG_MODULE_SIG_FORCE);
> #ifndef CONFIG_MODULE_SIG_FORCE
> -module_param(sig_enforce, bool_enable_only, 0644);
> +module_param_config_on(sig_enforce, sig_enforce, 0644, CONFIG_MODULE_SIG_FORCE);
> #endif /* !CONFIG_MODULE_SIG_FORCE */
>
> But neither actually, y'know, cleans up any #ifdefs.
OK, sure, its the use of IS_ENABLED() that does that as a first step.
> Simplicity is a major virtue. Readability is a major virtue. Brevity
> is only a minor virtue.
I was not shooting for brevity but instead aiming at the possible
grammatical gain of direct and immediate association between a bool, behaviour
(on_off, or just on), and a config. I don't have a need for the grammatical
association now so will drop this.
Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists