Messages in this thread | | | Subject | Re: PATCH: (Discussion) Stop IDE legacy ISA probes on PCI systems | From | Valdis.Kletnieks@vt ... | Date | Mon, 27 Dec 2004 17:15:39 -0500 |
| |
On Mon, 27 Dec 2004 21:15:26 GMT, Adam Sampson said: > Alan Cox <alan@lxorguk.ukuu.org.uk> 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 [unhandled content-type:application/pgp-signature] | |