Skip to contentSkip to conversation

parport_pc MODULE_PARM fix

PATCH In review Jonathan McDowell 2 participants 3 messages Dec 6, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 parport_pc MODULE_PARM fix

[I hope sending this to just the linux-parport list is the right thing to do; I'm assuming the maintainers read it and don't want individual CCs as well.]

In the 2.6.10-rc releases parport_pc doesn't seem to want to take any module parameters:

parport_pc: Ignoring new-style parameters in presence of obsolete ones
parport0: PC-style at 0x378 (0x778) [PCSPP,TRISTATE]
parport0: irq 7 detected

I need to pass parameters to the module to make it detect my port fully (the printer doesn't seem to want to print more than a page or so without an irq in use). With the patch below, against 2.6.10-rc3 I can do so and get:

parport0: PC-style at 0x378 (0x778), irq 7, dma 3 [PCSPP,TRISTATE,COMPAT,ECP,DMA]

------

parport/parport_pc.c renamed from parport/parport_pc.c.orig +3 -3
@@ -3157,7 +3157,7 @@
 #ifdef CONFIG_PCI
 static int __init parport_init_mode_setup(char *str)
 {
-	printk(KERN_DEBUG "parport_pc.c: Specified parameter parport_init_mode=%s\n", str);
+	DPRINTK(KERN_DEBUG "parport_pc.c: Specified parameter parport_init_mode=%s\n", str);
 
 	if (!strcmp (str, "spp"))
 		parport_init_mode=1;
@@ -3176,7 +3176,7 @@
 #ifdef MODULE
 static const char *irq[PARPORT_PC_MAX_PORTS];
 static const char *dma[PARPORT_PC_MAX_PORTS];
-static char *init_mode;
+static char init_mode[7];
 
 MODULE_PARM_DESC(io, "Base I/O address (SPP regs)");
 module_param_array(io, int, NULL, 0);
@@ -3193,7 +3193,7 @@
 #endif
 #ifdef CONFIG_PCI
 MODULE_PARM_DESC(init_mode, "Initialise mode for VIA VT8231 port (spp, ps2, epp, ecp or ecpepp)");
-MODULE_PARM(init_mode, "s");
+module_param_string(init_mode, init_mode, 7, 0);
 #endif
 
 static int __init parse_parport_params(void)

------

J.

Signature · 3 lines
                                            jid: [email protected]
Where are we going?  And WHY ARE WE IN
                                            THIS HANDBASKET?!!
#1 lore raw
Quoted 40 lines · Jonathan McDowell

[I hope sending this to just the linux-parport list is the right thing to do; I'm assuming the maintainers read it and don't want individual CCs as well.]

In the 2.6.10-rc releases parport_pc doesn't seem to want to take any module parameters:

parport_pc: Ignoring new-style parameters in presence of obsolete ones
parport0: PC-style at 0x378 (0x778) [PCSPP,TRISTATE]
parport0: irq 7 detected

I need to pass parameters to the module to make it detect my port fully (the printer doesn't seem to want to print more than a page or so without an irq in use). With the patch below, against 2.6.10-rc3 I can do so and get:

parport0: PC-style at 0x378 (0x778), irq 7, dma 3 [PCSPP,TRISTATE,COMPAT,ECP,DMA]

------

parport/parport_pc.c renamed from parport/parport_pc.c.orig +2 -2
@@ -3157,7 +3157,7 @@
 #ifdef CONFIG_PCI
 static int __init parport_init_mode_setup(char *str)
 {
-	printk(KERN_DEBUG "parport_pc.c: Specified parameter parport_init_mode=%s\n", str);
+	DPRINTK(KERN_DEBUG "parport_pc.c: Specified parameter parport_init_mode=%s\n", str);
 
 	if (!strcmp (str, "spp"))
 		parport_init_mode=1;
@@ -3176,7 +3176,7 @@
 #ifdef MODULE
 static const char *irq[PARPORT_PC_MAX_PORTS];
 static const char *dma[PARPORT_PC_MAX_PORTS];
-static char *init_mode;
+static char init_mode[7];
 
 MODULE_PARM_DESC(io, "Base I/O address (SPP regs)");
 module_param_array(io, int, NULL, 0);

parport/parport_pc.c line 3197

Quoted 6 lines
parport/parport_pc.c renamed from parport/parport_pc.c.orig +1 -1
@@ -3193,7 +3193,7 @@
 #endif
 #ifdef CONFIG_PCI
 MODULE_PARM_DESC(init_mode, "Initialise mode for VIA VT8231 port (spp, ps2, epp, ecp or ecpepp)");
-MODULE_PARM(init_mode, "s");
+module_param_string(init_mode, init_mode, 7, 0);
 #endif

I think that it should be:

module_param(init_mode, charp, 0);

and leave 'init_mode' as a char *, not a char array.

Can you test that change and resubmit the patch (if it works :) ?

Thanks,

Signature · 1 line
~Randy
#2 lore raw
Quoted 7 lines · Randy.Dunlap
Quoted 4 lines · Jonathan McDowell

ps2, epp, ecp or ecpepp)");

(quoted diff) +1 -1
-MODULE_PARM(init_mode, "s");
+module_param_string(init_mode, init_mode, 7, 0);

#endif

I think that it should be:

Quoted 5 lines

module_param(init_mode, charp, 0);

and leave 'init_mode' as a char *, not a char array.

Can you test that change and resubmit the patch (if it works :) ?

Even better; that does the trick too. Extremely trivial patch below.

-----

parport/parport_pc.c renamed from parport/parport_pc.c.orig +2 -2
@@ -3157,7 +3157,7 @@
 #ifdef CONFIG_PCI
 static int __init parport_init_mode_setup(char *str)
 {
-	printk(KERN_DEBUG "parport_pc.c: Specified parameter parport_init_mode=%s\n", str);
+	DPRINTK(KERN_DEBUG "parport_pc.c: Specified parameter parport_init_mode=%s\n", str);
 
 	if (!strcmp (str, "spp"))
 		parport_init_mode=1;
@@ -3193,7 +3193,7 @@
 #endif
 #ifdef CONFIG_PCI
 MODULE_PARM_DESC(init_mode, "Initialise mode for VIA VT8231 port (spp, ps2, epp, ecp or ecpepp)");
-MODULE_PARM(init_mode, "s");
+module_param(init_mode, charp, 0);
 #endif
 
 static int __init parse_parport_params(void)

-----

J.

Signature · 3 lines
/-\                             | 101 things you can't have too much
|@/  Debian GNU/Linux Developer |       of : 19 - A Good Thing.
\-                              |