Re: PATCH: (Discussion) Stop IDE legacy ISA probes on PCI systems

From: Valdis . Kletnieks
Date: Mon Dec 27 2004 - 17:19:34 EST


On Mon, 27 Dec 2004 21:15:26 GMT, Adam Sampson said:
> Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> writes:
>
> > switch (index) {
> > case 0: return 0x1f0;
> > case 1: return 0x170;
> > +
> > + if(pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL) == NULL) {
> > + case 2: return 0x1e8;
> > + case 3: return 0x168;
> > + case 4: return 0x1e0;
> > + case 5: return 0x160;
> > + }
> > +
> > default:
> > return 0;
> > }
>
> I don't think that code will have the intended effect, unless your
> GCC has some funny ideas about switch statements...

Those who don't understand the Duff Device are doomed to re-invent it, poorly. ;)

(Yes Alan, I know *you* know C well enough, but I just looked at that block
of code and it looked *so* much like Tom Duff's that I had to say it. ;)

For those not in the know:

http://www.lysator.liu.se/c/duffs-device.html

Attachment: pgp00000.pgp
Description: PGP signature