public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Patch: Fix BUGging in ide-disk.c
@ 2003-03-17 22:17 Nigel Cunningham
  2003-03-18  8:26 ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: Nigel Cunningham @ 2003-03-17 22:17 UTC (permalink / raw)
  To: Pavel Machek, Linux Kernel Mailing List, Linus Torvalds

Hi.

This patch fixes a problem with the suspend/resume code in ide-disk.c
which is triggered when the code is called multiple times for a drive.
When the second resume call was made, the BUG was activated.

Please apply if something hasn't already been done about this.

Regards,

Nigel

-- 
Nigel Cunningham
495 St Georges Road South, Hastings 4201, New Zealand

Be diligent to present yourself approved to God as a workman who does
not need to be ashamed, handling accurately the word of truth.
	-- 2 Timothy 2:14, NASB.

diff -ruN linux-2.5.64-original/drivers/ide/ide-disk.c
linux-2.5.64-clean/drivers/ide/ide-disk.c
--- linux-2.5.64-original/drivers/ide/ide-disk.c	2002-12-11 11:45:51.000000000 +1300
+++ linux-2.5.64-clean/drivers/ide/ide-disk.c	2003-03-18 08:59:29.000000000 +1200
@@ -1552,7 +1552,8 @@
 	/* set the drive to standby */
 	printk(KERN_INFO "suspending: %s ", drive->name);
 	do_idedisk_standby(drive);
-	drive->blocked = 1;
+	/* Handle multiple calls for the same drive without bugging */
+	drive->blocked++;
 
 	BUG_ON (HWGROUP(drive)->handler);
 	return 0;
@@ -1562,10 +1563,14 @@
 {
 	ide_drive_t *drive = dev->driver_data;
 
+	printk("Resuming device %p\n", dev->driver_data);
+
 	if (level != RESUME_RESTORE_STATE)
 		return 0;
-	BUG_ON(!drive->blocked);
-	drive->blocked = 0;
+	if (drive->blocked)
+		drive->blocked--;
+	else
+		printk("Warning: More calls to resume device %p than calls to suspend it.\n", dev->driver_data);
 	return 0;
 }



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

* Re: Patch: Fix BUGging in ide-disk.c
  2003-03-17 22:17 Patch: Fix BUGging in ide-disk.c Nigel Cunningham
@ 2003-03-18  8:26 ` Pavel Machek
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2003-03-18  8:26 UTC (permalink / raw)
  To: Nigel Cunningham; +Cc: Pavel Machek, Linux Kernel Mailing List, Linus Torvalds

Hi!

> This patch fixes a problem with the suspend/resume code in ide-disk.c
> which is triggered when the code is called multiple times for a drive.
> When the second resume call was made, the BUG was activated.
> 
> Please apply if something hasn't already been done about this.

Yes, this looks good.
								Pavel

-- 
Horseback riding is like software...
...vgf orggre jura vgf serr.

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

end of thread, other threads:[~2003-03-18  8:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-17 22:17 Patch: Fix BUGging in ide-disk.c Nigel Cunningham
2003-03-18  8:26 ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox