Re: Parport irq detection problem in 2.1.62 (patch supplied.)

Niels Kristian Bech Jensen (nkbj@image.dk)
Mon, 10 Nov 1997 09:07:09 +0100 (MET)


On Sun, 9 Nov 1997, Tim Waugh wrote:

> Well, one solution would presumably be to change the lines to something
> like:
>
> static int dma[8] = {-1, -1, -1, -1, -1, -1, -1, -1};
> static int irq[8] = {-1, -1, -1, -1, -1, -1, -1, -1};
>
> Obviously that's not very good, as it kind of defeats the point of
> PC_MAX_PORTS being a configurable constant. Could you just check that
> this sort of thing fixes the problem?
>
> Thanks,
> Tim.
> */
>
Yes, this solves the problem, which is clearly that the arrays (io,) dma
and irq isn't initialized. The problem shows up when PnP support
(parport_probe.c) AND parport_pc.c are both compiled as modules.

A working but crude way of solving the problem is this:

--- linux/drivers/misc/parport_pc.c.orig Fri Nov 7 11:38:50 1997
+++ linux/drivers/misc/parport_pc.c Mon Nov 10 08:46:06 1997
@@ -889,15 +889,24 @@
}

#ifdef MODULE
-static int io[PC_MAX_PORTS+1] = { 0, };
-static int dma[PC_MAX_PORTS] = { PARPORT_DMA_AUTO, };
-static int irq[PC_MAX_PORTS] = { PARPORT_IRQ_AUTO, };
+static int io[PC_MAX_PORTS+1];
+static int dma[PC_MAX_PORTS];
+static int irq[PC_MAX_PORTS];
MODULE_PARM(io, "1-" __MODULE_STRING(PC_MAX_PORTS) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(PC_MAX_PORTS) "i");
MODULE_PARM(dma, "1-" __MODULE_STRING(PC_MAX_PORTS) "i");

int init_module(void)
{
+ int i;
+
+ for (i = 0; i < PC_MAX_PORTS; i++) {
+ io[i] = 0;
+ dma[i] = PARPORT_DMA_AUTO;
+ irq[i] = PARPORT_IRQ_AUTO;
+ }
+ io[PC_MAX_PORTS] = 0;
+
return (parport_pc_init(io, irq, dma)?0:1);
}

Another problem is that the parport_probe module isn't unloaded by
kerneld. The cleanup_module function in parport_probe.c is empty.

--
Med venlig hilsen / Regards

Niels Kristian Bech Jensen nkbj@image.dk http://www.image.dk/~nkbj/