[PATCH] Re: module_param() doesn't seem to work in 2.6.6-rc1

From: Pavel Roskin
Date: Fri Apr 16 2004 - 18:39:54 EST


On Fri, 16 Apr 2004, Pavel Roskin wrote:

> A bigger problem is that the new parameters cannot be used on the modprobe
> command line. I added this to orinoco.c:
>
> static int parmtest1, parmtest2;
> MODULE_PARM(parmtest1, "i");
> module_param(parmtest2, int, 644);

P.S. load_module() in kernel/module.c would not check new parameters if
old parameters are present. In my tests old parameters were always
present. Once I converted everything, the parameters started working
again.

Parsing both types of parameters may be non-trivial, and should not be
really needed. However, a warning could have saved me some time.

The attached patch prints a warning if both new-style and obsolete
parameters are present in the module. The warning is printed regardless
of whether any parameters are specified, which is intentional.

Several drivers under drivers/pcmcia have this problem. The patch will be
posted to the pcmcia list.

--
Regards,
Pavel Roskin--- linux.orig/kernel/module.c
+++ linux/kernel/module.c
@@ -1541,6 +1541,10 @@ static struct module *load_module(void _
/ sizeof(struct obsolete_modparm),
sechdrs, symindex,
(char *)sechdrs[strindex].sh_addr);
+ if (sechdrs[setupindex].sh_size)
+ printk(KERN_WARNING "%s: Ignoring new-style "
+ "parameters in presence of obsolete ones\n",
+ mod->name);
} else {
/* Size of section 0 is 0, so this works well if no params */
err = parse_args(mod->name, mod->args,