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

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


On Mon, 10 Nov 1997, Niels Kristian Bech Jensen wrote:

> On Mon, 10 Nov 1997, Tim Waugh wrote:
>
> > On Mon, 10 Nov 1997, Niels Kristian Bech Jensen wrote:
> >
> > > A working but crude way of solving the problem is this:
> > >
> > > [...]
> > >
> > > 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);
> > > }
> >
> > Doesn't this stop things working like "modprobe parport_pc io=0x378
> > irq=7"?
> >
> Yes, unfortunately it does. Your previous idea of filling the arrays by
> hand works in both cases:
>
This solves the problem in a general way, but it makes the code GCC
specific (not a problem IMHO):

--- linux/drivers/misc/parport_pc.c.orig Mon Nov 10 09:57:49 1997
+++ linux/drivers/misc/parport_pc.c Mon Nov 10 12:08:48 1997
@@ -889,9 +889,9 @@
}

#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] = { [0 ... PC_MAX_PORTS] = 0 };
+static int dma[PC_MAX_PORTS] = { [0 ... PC_MAX_PORTS-1] = PARPORT_DMA_AUTO };
+static int irq[PC_MAX_PORTS] = { [0 ... PC_MAX_PORTS-1] = PARPORT_IRQ_AUTO };
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");

--
Med venlig hilsen / Regards

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