public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nigel Cunningham <ncunningham@clear.net.nz>
To: Pavel Machek <pavel@ucw.cz>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@transmeta.com>
Subject: Patch: Fix BUGging in ide-disk.c
Date: Tue, 18 Mar 2003 10:17:59 +1200	[thread overview]
Message-ID: <1047939287.5426.5.camel@laptop-linux.cunninghams> (raw)

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;
 }



             reply	other threads:[~2003-03-17 22:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-17 22:17 Nigel Cunningham [this message]
2003-03-18  8:26 ` Patch: Fix BUGging in ide-disk.c Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1047939287.5426.5.camel@laptop-linux.cunninghams \
    --to=ncunningham@clear.net.nz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox