linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PATCH: (Discussion) Stop IDE legacy ISA probes on PCI systems
@ 2004-12-27 14:13 Alan Cox
  2004-12-27 21:15 ` Adam Sampson
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2004-12-27 14:13 UTC (permalink / raw)
  To: torvalds, Linux Kernel Mailing List, linux-ide,
	Bartlomiej Zolnierkiewicz

We don't generally want to poke around legacy ISA ide2..ide5 on a system
with PCI , it tends to cause long delays. 

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.10/include/asm-i386/ide.h linux-2.6.10/include/asm-i386/ide.h
--- linux.vanilla-2.6.10/include/asm-i386/ide.h	2004-12-25 21:13:51.000000000 +0000
+++ linux-2.6.10/include/asm-i386/ide.h	2004-12-26 17:08:27.541915144 +0000
@@ -44,10 +44,14 @@
 	switch (index) {
 		case 0:	return 0x1f0;
 		case 1:	return 0x170;
-		case 2: return 0x1e8;
-		case 3: return 0x168;
-		case 4: return 0x1e0;
-		case 5: return 0x160;
+		
+		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;
 	}


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: (Discussion) Stop IDE legacy ISA probes on PCI systems
  2004-12-27 14:13 PATCH: (Discussion) Stop IDE legacy ISA probes on PCI systems Alan Cox
@ 2004-12-27 21:15 ` Adam Sampson
  2004-12-27 22:15   ` Valdis.Kletnieks
  2004-12-28  0:29   ` Linus Torvalds
  0 siblings, 2 replies; 5+ messages in thread
From: Adam Sampson @ 2004-12-27 21:15 UTC (permalink / raw)
  To: Alan Cox
  Cc: torvalds, Linux Kernel Mailing List, linux-ide,
	Bartlomiej Zolnierkiewicz

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...

-- 
Adam Sampson <azz@us-lot.org>                        <http://offog.org/>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: (Discussion) Stop IDE legacy ISA probes on PCI systems
  2004-12-27 21:15 ` Adam Sampson
@ 2004-12-27 22:15   ` Valdis.Kletnieks
  2004-12-28  0:29   ` Linus Torvalds
  1 sibling, 0 replies; 5+ messages in thread
From: Valdis.Kletnieks @ 2004-12-27 22:15 UTC (permalink / raw)
  To: Adam Sampson
  Cc: Alan Cox, torvalds, Linux Kernel Mailing List, linux-ide,
	Bartlomiej Zolnierkiewicz

[-- Attachment #1: Type: text/plain, Size: 869 bytes --]

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

[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: (Discussion) Stop IDE legacy ISA probes on PCI systems
  2004-12-27 21:15 ` Adam Sampson
  2004-12-27 22:15   ` Valdis.Kletnieks
@ 2004-12-28  0:29   ` Linus Torvalds
  2004-12-28  3:58     ` Coywolf Qi Hunt
  1 sibling, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2004-12-28  0:29 UTC (permalink / raw)
  To: Adam Sampson
  Cc: Alan Cox, Linux Kernel Mailing List, linux-ide,
	Bartlomiej Zolnierkiewicz



On Mon, 27 Dec 2004, Adam Sampson wrote:
> 
> I don't think that code will have the intended effect, unless your
> GCC has some funny ideas about switch statements...

Indeed. That if-statement is unreachable and has no effect.

		Linus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: (Discussion) Stop IDE legacy ISA probes on PCI systems
  2004-12-28  0:29   ` Linus Torvalds
@ 2004-12-28  3:58     ` Coywolf Qi Hunt
  0 siblings, 0 replies; 5+ messages in thread
From: Coywolf Qi Hunt @ 2004-12-28  3:58 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Adam Sampson, Alan Cox, Linux Kernel Mailing List, linux-ide,
	Bartlomiej Zolnierkiewicz

This should solve the problem. 

              coywolf


--- linux-2.6.10/include/asm-i386/ide.h 2004-10-19 05:53:13.000000000 +0800
+++ linux-2.6.10-cy/include/asm-i386/ide.h      2004-12-28
11:45:38.000000000 +0800
@@ -44,13 +44,18 @@ static __inline__ unsigned long ide_defa
        switch (index) {
                case 0: return 0x1f0;
                case 1: return 0x170;
-               case 2: return 0x1e8;
-               case 3: return 0x168;
-               case 4: return 0x1e0;
-               case 5: return 0x160;
-               default:
-                       return 0;
        }
+
+       if (pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL) == NULL) {
+               switch (index) {
+                       case 2: return 0x1e8;
+                       case 3: return 0x168;
+                       case 4: return 0x1e0;
+                       case 5: return 0x160;
+               }
+       }
+
+       return 0;
 }

 #define IDE_ARCH_OBSOLETE_INIT


On Mon, 27 Dec 2004 16:29:52 -0800 (PST), Linus Torvalds
<torvalds@osdl.org> wrote:
> 
> 
> On Mon, 27 Dec 2004, Adam Sampson wrote:
> >
> > I don't think that code will have the intended effect, unless your
> > GCC has some funny ideas about switch statements...
> 
> Indeed. That if-statement is unreachable and has no effect.
> 
>                 Linus
> -

-- 
Coywolf Qi Hunt
Homepage http://sosdg.org/~coywolf/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-12-28  3:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-27 14:13 PATCH: (Discussion) Stop IDE legacy ISA probes on PCI systems Alan Cox
2004-12-27 21:15 ` Adam Sampson
2004-12-27 22:15   ` Valdis.Kletnieks
2004-12-28  0:29   ` Linus Torvalds
2004-12-28  3:58     ` Coywolf Qi Hunt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).