From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: Rusty Russell <rusty@rustcorp.com.au>,
Julia Lawall <julia.lawall@lip6.fr>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
akpm@linux-foundation.org, mingo@kernel.org, tj@kernel.org,
linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org,
keescook@chromium.org, casey@schaufler-ca.com,
cocci@systeme.lip6.fr, Jani Nikula <jani.nikula@intel.com>
Subject: Re: [PATCH v2 4/8] moduleparam.h: add module_param_config_*() helpers
Date: Thu, 23 Apr 2015 21:33:39 +0200 [thread overview]
Message-ID: <20150423193339.GO5622@wotan.suse.de> (raw)
In-Reply-To: <87618noaj6.fsf@rustcorp.com.au>
On Thu, Apr 23, 2015 at 11:45:09AM +0930, Rusty Russell wrote:
> "Luis R. Rodriguez" <mcgrof@do-not-panic.com> writes:
> > From: "Luis R. Rodriguez" <mcgrof@suse.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
next prev parent reply other threads:[~2015-04-23 19:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 21:55 [PATCH v2 0/8] module params: few simplifications Luis R. Rodriguez
2015-04-22 21:55 ` [PATCH v2 1/8] kernel/params: constify struct kernel_param_ops uses Luis R. Rodriguez
2015-04-22 21:55 ` [PATCH v2 2/8] kernel/module.c: use generic module param operaters for sig_enforce Luis R. Rodriguez
2015-04-22 21:55 ` [PATCH v2 3/8] kernel/params.c: generalize bool_enable_only Luis R. Rodriguez
2015-04-23 15:22 ` Tejun Heo
2015-04-23 17:00 ` Luis R. Rodriguez
2015-04-22 21:55 ` [PATCH v2 4/8] moduleparam.h: add module_param_config_*() helpers Luis R. Rodriguez
2015-04-23 2:15 ` Rusty Russell
2015-04-23 19:33 ` Luis R. Rodriguez [this message]
2015-04-22 21:55 ` [PATCH v2 5/8] kernel/workqueue.c: remove ifdefs over wq_power_efficient Luis R. Rodriguez
2015-04-22 21:55 ` [PATCH v2 6/8] kernel/workqueue.c: use module_param_config_on_off() for power_efficient Luis R. Rodriguez
2015-04-22 21:55 ` [PATCH v2 7/8] kernel/module.c: avoid ifdefs for sig_enforce declaration Luis R. Rodriguez
2015-04-22 21:55 ` [PATCH v2 8/8] kernel/module.c: use module_param_config_on() for sig_enforce Luis R. Rodriguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150423193339.GO5622@wotan.suse.de \
--to=mcgrof@suse.com \
--cc=akpm@linux-foundation.org \
--cc=casey@schaufler-ca.com \
--cc=cocci@systeme.lip6.fr \
--cc=jani.nikula@intel.com \
--cc=julia.lawall@lip6.fr \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mcgrof@do-not-panic.com \
--cc=mingo@kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®