patch-pre2.0.2 linux/drivers/block/ide.c

Next file: linux/drivers/block/ide_modes.h
Previous file: linux/drivers/block/README.ide
Back to the patch index
Back to the overall index

diff -u --recursive --new-file pre2.0.1/linux/drivers/block/ide.c linux/drivers/block/ide.c
@@ -1,19 +1,22 @@
 /*
- *  linux/drivers/block/ide.c	Version 5.41  May 9, 1996
+ *  linux/drivers/block/ide.c	Version 5.42  May 12, 1996
  *
  *  Copyright (C) 1994-1996  Linus Torvalds & authors (see below)
  */
 #define _IDE_C		/* needed by <linux/blk.h> */
 
 /*
+ *  Maintained by Mark Lord  <mlord@pobox.com>
+ *            and Gadi Oxman <gadio@netvision.net.il>
+ *
  * This is the multiple IDE interface driver, as evolved from hd.c.
  * It supports up to four IDE interfaces, on one or more IRQs (usually 14 & 15).
  * There can be up to two drives per interface, as per the ATA-2 spec.
  *
- * Primary i/f:    ide0: major=3;  (hda)         minor=0; (hdb)         minor=64
- * Secondary i/f:  ide1: major=22; (hdc or hd1a) minor=0; (hdd or hd1b) minor=64
- * Tertiary i/f:   ide2: major=33; (hde)         minor=0; (hdf)         minor=64
- * Quaternary i/f: ide3: major=34; (hdg)         minor=0; (hdh)         minor=64
+ * Primary:    ide0, port 0x1f0; major=3;  hda is minor=0; hdb is minor=64
+ * Secondary:  ide1, port 0x170; major=22; hdc is minor=0; hdd is minor=64
+ * Tertiary:   ide2, port 0x???; major=33; hde is minor=0; hdf is minor=64
+ * Quaternary: ide3, port 0x???; major=34; hdg is minor=0; hdh is minor=64
  *
  * It is easy to extend ide.c to handle more than four interfaces:
  *
@@ -51,11 +54,8 @@
  *
  *	Mark Lord	(mlord@pobox.com)		(IDE Perf.Pkg)
  *	Delman Lee	(delman@mipg.upenn.edu)		("Mr. atdisk2")
- *	Petri Mattila	(ptjmatti@kruuna.helsinki.fi)	(EIDE stuff)
  *	Scott Snyder	(snyder@fnald0.fnal.gov)	(ATAPI IDE cd-rom)
  *
- *  Maintained by Mark Lord (mlord@pobox.com):  ide.c, ide.h, triton.c, hd.c, ..
- *
  *  This was a rewrite of just about everything from hd.c, though some original
  *  code is still sprinkled about.  Think of it as a major evolution, with
  *  inspiration from lots of linux users, esp.  hamish@zot.apana.org.au
@@ -235,6 +235,8 @@
  *			help sharing by masking device irq after probing
  * Version 5.41		more fixes to irq sharing/serialize detection
  *			disable io_32bit by default on drive reset
+ * Version 5.42		simplify irq-masking after probe
+ *			fix NULL pointer deref in save_match()
  *
  *  Some additional driver compile-time options are in ide.h
  *
@@ -2419,12 +2421,11 @@
 	} else
 		rc = 2;			/* drive refused ID */
 	if (!HWIF(drive)->irq) {
+		OUT_BYTE(drive->ctl|2,IDE_CONTROL_REG); /* mask device irq */
+		udelay(5);
 		irqs = probe_irq_off(irqs);	/* get our irq number */
 		if (irqs > 0) {
 			HWIF(drive)->irq = irqs; /* save it for later */
-			irqs = probe_irq_on();  /* grab irqs, to ignore next edge */
-			OUT_BYTE(drive->ctl|2,IDE_CONTROL_REG); /* mask device irq */
-			(void) probe_irq_off(irqs); /* restore irqs again */
 		} else {	/* Mmmm.. multiple IRQs.. don't know which was ours */
 			printk("%s: IRQ probe failed (%d)\n", drive->name, irqs);
 #ifdef CONFIG_BLK_DEV_CMD640
@@ -3032,7 +3033,7 @@
 			return;
 		printk("%s: potential irq problem with %s and %s\n", hwif->name, new->name, m->name);
 	}
-	if (m->irq != hwif->irq) /* don't undo a prior perfect match */
+	if (!m || m->irq != hwif->irq) /* don't undo a prior perfect match */
 		*match = new;
 }
 #endif /* MAX_HWIFS > 1 */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this