patch-2.1.15 linux/drivers/block/ide-floppy.c

Next file: linux/drivers/block/ide-probe.c
Previous file: linux/drivers/block/ide-disk.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.14/linux/drivers/block/ide-floppy.c linux/drivers/block/ide-floppy.c
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/block/ide-floppy.c	Version 0.2 - ALPHA	Oct  31, 1996
+ * linux/drivers/block/ide-floppy.c	Version 0.3 - ALPHA	Dec   2, 1996
  *
  * Copyright (C) 1996 Gadi Oxman <gadio@netvision.net.il>
  */
@@ -15,6 +15,7 @@
  *
  * Ver 0.1   Oct 17 96   Initial test version, mostly based on ide-tape.c.
  * Ver 0.2   Oct 31 96   Minor changes.
+ * Ver 0.3   Dec  2 96   Fixed error recovery bug.
  */
 
 #include <linux/config.h>
@@ -451,21 +452,26 @@
 static void idefloppy_end_request (byte uptodate, ide_hwgroup_t *hwgroup)
 {
 	ide_drive_t *drive = hwgroup->drive;
+	idefloppy_floppy_t *floppy = drive->driver_data;
 	struct request *rq = hwgroup->rq;
+	int error;
 
 #if IDEFLOPPY_DEBUG_LOG
 	printk (KERN_INFO "Reached idefloppy_end_request\n");
 #endif /* IDEFLOPPY_DEBUG_LOG */
 
+	switch (uptodate) {
+		case 0: error = IDEFLOPPY_ERROR_GENERAL; break;
+		case 1: error = 0; break;
+		default: error = uptodate;
+	}
+	if (error)
+		floppy->failed_pc = NULL;
 	if (!IDEFLOPPY_RQ_CMD (rq->cmd)) {
 		ide_end_request (uptodate, hwgroup);
 		return;
 	}
-	switch (uptodate) {
-		case 0: rq->errors = IDEFLOPPY_ERROR_GENERAL; break;
-		case 1: rq->errors = 0; break;
-		default: rq->errors = uptodate;
-	}
+	rq->errors = error;
 	ide_end_drive_cmd (drive, 0, 0);
 }
 
@@ -967,8 +973,11 @@
 #endif /* IDEFLOPPY_DEBUG_LOG */
 
 	if (rq->errors >= ERROR_MAX) {
-		printk (KERN_ERR "ide-floppy: %s: I/O error, pc = %2x, key = %2x, asc = %2x, ascq = %2x\n",
-			drive->name, floppy->failed_pc->c[0], floppy->sense_key, floppy->asc, floppy->ascq);
+		if (floppy->failed_pc != NULL)
+			printk (KERN_ERR "ide-floppy: %s: I/O error, pc = %2x, key = %2x, asc = %2x, ascq = %2x\n",
+				drive->name, floppy->failed_pc->c[0], floppy->sense_key, floppy->asc, floppy->ascq);
+		else
+			printk (KERN_ERR "ide-floppy: %s: I/O error\n", drive->name);
 		idefloppy_end_request (0, HWGROUP(drive));
 		return;
 	}
@@ -1367,6 +1376,7 @@
 	ide_floppy,		/* media */
 	0,			/* busy */
 	1,			/* supports_dma */
+	0,			/* supports_dsc_overlap */
 	idefloppy_cleanup,	/* cleanup */
 	idefloppy_do_request,	/* do_request */
 	idefloppy_end_request,	/* end_request */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov