linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][2.5][RFC] ide_drive_remove oddity?
@ 2002-10-15  5:34 Zwane Mwaikambo
  0 siblings, 0 replies; only message in thread
From: Zwane Mwaikambo @ 2002-10-15  5:34 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Andre Hedrick, Russell King, Bartlomiej Zolnierkiewicz

Can you really issue a cache flush command after issuing a device standby?

Here is an untested/uncompiled patch which makes it standby after a 
cleanup.

Clue sticks at the ready gentlemen!

	Zwane

Index: linux-2.5.42/drivers/ide/ide-cd.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.42/drivers/ide/ide-cd.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ide-cd.c
--- linux-2.5.42/drivers/ide/ide-cd.c	12 Oct 2002 16:54:46 -0000	1.1.1.1
+++ linux-2.5.42/drivers/ide/ide-cd.c	15 Oct 2002 05:22:18 -0000
@@ -3026,13 +3026,7 @@
 {
 	struct cdrom_info *info = drive->driver_data;
 	struct cdrom_device_info *devinfo = &info->devinfo;
-	struct gendisk *g = drive->disk;
 
-	if (ide_unregister_subdriver(drive)) {
-		printk("%s: %s: failed to ide_unregister_subdriver\n",
-			__FUNCTION__, drive->name);
-		return 1;
-	}
 	if (info->buffer != NULL)
 		kfree(info->buffer);
 	if (info->toc != NULL)
@@ -3043,7 +3037,6 @@
 		printk("%s: ide_cdrom_cleanup failed to unregister device from the cdrom driver.\n", drive->name);
 	kfree(info);
 	drive->driver_data = NULL;
-	del_gendisk(g);
 	return 0;
 }
 
Index: linux-2.5.42/drivers/ide/ide-disk.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.42/drivers/ide/ide-disk.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ide-disk.c
--- linux-2.5.42/drivers/ide/ide-disk.c	12 Oct 2002 16:54:46 -0000	1.1.1.1
+++ linux-2.5.42/drivers/ide/ide-disk.c	15 Oct 2002 05:19:14 -0000
@@ -1790,15 +1790,10 @@
 
 static int idedisk_cleanup (ide_drive_t *drive)
 {
-	struct gendisk *g = drive->disk;
-
 	if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
 		if (do_idedisk_flushcache(drive))
 			printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n",
 				drive->name);
-	if (ide_unregister_subdriver(drive))
-		return 1;
-	del_gendisk(g);
 	return 0;
 }
 
Index: linux-2.5.42/drivers/ide/ide-floppy.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.42/drivers/ide/ide-floppy.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ide-floppy.c
--- linux-2.5.42/drivers/ide/ide-floppy.c	12 Oct 2002 16:54:46 -0000	1.1.1.1
+++ linux-2.5.42/drivers/ide/ide-floppy.c	15 Oct 2002 05:23:47 -0000
@@ -2014,13 +2014,8 @@
 static int idefloppy_cleanup (ide_drive_t *drive)
 {
 	idefloppy_floppy_t *floppy = drive->driver_data;
-	struct gendisk *g = drive->disk;
-
-	if (ide_unregister_subdriver(drive))
-		return 1;
 	drive->driver_data = NULL;
 	kfree(floppy);
-	del_gendisk(g);
 	return 0;
 }
 
Index: linux-2.5.42/drivers/ide/ide-tape.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.42/drivers/ide/ide-tape.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ide-tape.c
--- linux-2.5.42/drivers/ide/ide-tape.c	12 Oct 2002 16:54:46 -0000	1.1.1.1
+++ linux-2.5.42/drivers/ide/ide-tape.c	15 Oct 2002 05:24:28 -0000
@@ -6145,7 +6145,6 @@
 	idetape_chrdevs[minor].drive = NULL;
 	spin_unlock_irqrestore(&ide_lock, flags);
 	DRIVER(drive)->busy = 0;
-	(void) ide_unregister_subdriver(drive);
 	drive->driver_data = NULL;
 	devfs_unregister(tape->de_r);
 	devfs_unregister(tape->de_n);
Index: linux-2.5.42/drivers/ide/ide.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.42/drivers/ide/ide.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ide.c
--- linux-2.5.42/drivers/ide/ide.c	12 Oct 2002 16:54:46 -0000	1.1.1.1
+++ linux-2.5.42/drivers/ide/ide.c	15 Oct 2002 05:30:33 -0000
@@ -3426,14 +3426,22 @@
 static int ide_drive_remove(struct device * dev)
 {
 	ide_drive_t * drive = container_of(dev,ide_drive_t,gendev);
+	struct gendisk *g = drive->disk;
 	ide_driver_t * driver = drive->driver;
 
 	if (driver) {
-		if (driver->standby)
-			driver->standby(drive);
 		if (driver->cleanup)
 			driver->cleanup(drive);
+
+		if (driver->standby)
+			driver->standby(drive);
+
+		if (ide_unregister_subdriver(drive))
+			return 1;
 	}
+	
+	if (g)
+		del_gendisk(g);
 	
 	return 0;
 }

-- 
function.linuxpower.ca



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-10-15  5:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-15  5:34 [PATCH][2.5][RFC] ide_drive_remove oddity? Zwane Mwaikambo

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