Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: tj@kernel.org (Tejun Heo)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH v1 4/6] moduleparam.h: add module_param_config_*() helpers
Date: Tue, 21 Apr 2015 11:21:36 -0400	[thread overview]
Message-ID: <20150421152136.GC9455@htj.duckdns.org> (raw)
In-Reply-To: <1429572637-30234-5-git-send-email-mcgrof@do-not-panic.com>

On Mon, Apr 20, 2015 at 04:30:35PM -0700, Luis R. Rodriguez wrote:
>  /**
> + * module_param_config_on_off - bool parameter with run time override
> + * @name: a valid C identifier which is the parameter name.
> + * @value: the actual lvalue to alter.
> + * @perm: visibility in sysfs.
> + * @config: kernel parameter which will enable this option if this
> + * 	kernel configuration option has been enabled.
> + *
> + * This lets you define a bool module paramter which by default will be
> + * set to true if the config option has been set on your kernel's
> + * configuration, otherwise it is set to false.
> + */
> +#define module_param_config_on_off(name, var, perm, config) 		\
> +	static bool var = IS_ENABLED(config);				\
> +	module_param_named(name, var, bool, perm);

Maybe we want to make @config just a boolean initializer?
e.g. something like

#define module_param_config_on_off(name, var, perm, on_off) 		\
	static bool var = on_off;					\
	module_param_named(name, var, bool, perm);

so that the caller does IS_ENABLED() or whatever that's necessary?  It
just seems a bit too restricted.

Thanks.

-- 
tejun

  parent reply	other threads:[~2015-04-21 15:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-20 23:30 [Cocci] [PATCH v1 0/6] module params: few simplifications Luis R. Rodriguez
2015-04-20 23:30 ` Luis R. Rodriguez
2015-04-21 10:20   ` Arend van Spriel
2015-04-20 23:30 ` [Cocci] [PATCH v1 2/6] kernel/module.c: use generic module param operaters for sig_enforce Luis R. Rodriguez
2015-04-20 23:30 ` [Cocci] [PATCH v1 3/6] kernel/params.c: generalize bool_enable_only Luis R. Rodriguez
2015-04-20 23:30 ` [Cocci] [PATCH v1 4/6] moduleparam.h: add module_param_config_*() helpers Luis R. Rodriguez
2015-04-20 23:42   ` Julian Calaby
2015-04-21 16:41     ` Luis R. Rodriguez
2015-04-21 15:21   ` Tejun Heo [this message]
2015-04-21 16:55     ` Luis R. Rodriguez
2015-04-21 20:58       ` Tejun Heo
2015-04-22  7:15   ` Rusty Russell
2015-04-20 23:30 ` [Cocci] [PATCH v1 5/6] kernel/workqueue.c: use module_param_config_on_off() for power_efficient Luis R. Rodriguez
2015-04-20 23:30 ` [Cocci] [PATCH v1 6/6] 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=20150421152136.GC9455@htj.duckdns.org \
    --to=tj@kernel.org \
    --cc=cocci@systeme.lip6.fr \
    /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