[ltp] [PATCH 1/1] force_io is of type int, so check for this type instead of bool.
Bjørn Mork
linux-thinkpad@linux-thinkpad.org
Thu, 18 Apr 2013 09:56:26 +0200
Joerg Mayer <jmayer@loplof.de> writes:
> Fixes the following warning:
>
> CC [M] /home/jmayer/work/thinkpad/git/thinkpad_ec.o
> In file included from /usr/src/linux-3.8.7-1/include/linux/module.h:17:0,
> from /home/jmayer/work/thinkpad/git/thinkpad_ec.c:33:
> /home/jmayer/work/thinkpad/git/thinkpad_ec.c: In function ‘__chec=
k_force_io’:
> /usr/src/linux-3.8.7-1/include/linux/moduleparam.h:338:45: warning: retur=
n from incompatible pointer type [enabled by default]
> static inline type *__check_##name(void) { return(p); }
> ^
> /usr/src/linux-3.8.7-1/include/linux/moduleparam.h:384:35: note: in expan=
sion of macro ‘__param_check’
> #define param_check_bool(name, p) __param_check(name, p, bool)
> ^
> /usr/src/linux-3.8.7-1/include/linux/moduleparam.h:116:2: note: in expans=
ion of macro ‘param_check_bool’
> param_check_##type(name, &(value)); \
> ^
> /home/jmayer/work/thinkpad/git/thinkpad_ec.c:100:1: note: in expansion of=
macro ‘module_param_named’
> module_param_named(force_io, force_io, bool, 0600);
> ^
>
> Signed-off-by: Joerg Mayer <jmayer@loplof.de>
> ---
> :100644 100644 a1c94d9... ea8bcbf... M thinkpad_ec.c
> thinkpad_ec.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/thinkpad_ec.c b/thinkpad_ec.c
> index a1c94d9..ea8bcbf 100644
> --- a/thinkpad_ec.c
> +++ b/thinkpad_ec.c
> @@ -97,7 +97,7 @@ static DEFINE_SEMAPHORE(thinkpad_ec_mutex);
> /* Kludge in case the ACPI DSDT reserves the ports we need. */
> static int force_io; /* Willing to do IO to ports we couldn't reserve=
? */
> static int reserved_io; /* Successfully reserved the ports? */
> -module_param_named(force_io, force_io, bool, 0600);
> +module_param_named(force_io, force_io, int, 0600);
> MODULE_PARM_DESC(force_io, "Force IO even if region already reserved (0=
=off, 1=on)");
Wouldn't it be better to change the type of force_io to bool?
We usually prefer that to integers for any boolean variable, and keeping
the module_param bool has the advantage that you can use the 'Y' or 'N'
aliases instead of '0' or '1'.
BTW, using the "_named" variant of the macro seems unnecessary here,
given that the parameter and variable have the same name...
Bjørn