linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jeff Garzik <jeff@garzik.org>, Greg KH <greg@kroah.com>,
	"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
	pavel@suse.cz
Subject: [PATCH] libata: disable pdev on all suspend events
Date: Tue, 20 Feb 2007 18:14:48 +0900	[thread overview]
Message-ID: <45DABC08.9030607@gmail.com> (raw)
In-Reply-To: <45D6FE5A.1080603@gmail.com>

libata used disable pdev only on PM_EVENT_SUSPEND while re-enable pdev
unconditionally.  This was okay before ref-counted pdev enable update
but it now makes the pdev pinned after swsusp cycle (enabled twice but
disabled only once) and devres sanity check whines about it.

Fix it by unconditionally disabling pdev on all suspend events.

Signed-off-by: Tejun Heo <htejun@gmail.com>
---
Pavel, I took your advice and chose to disable unconditionally rather
than recording the status separately, but I still think it would be
nice if we can tell the status we're waking from from either the mesg
itself (say, PM_EVENT_THAW) or recorded prev state.

Both STM and STD are tested.  Please apply.  Thanks.

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 2cf8251..12bde4b 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6001,11 +6001,10 @@ int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits)
 void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg)
 {
 	pci_save_state(pdev);
+	pci_disable_device(pdev);
 
-	if (mesg.event == PM_EVENT_SUSPEND) {
-		pci_disable_device(pdev);
+	if (mesg.event == PM_EVENT_SUSPEND)
 		pci_set_power_state(pdev, PCI_D3hot);
-	}
 }
 
 int ata_pci_device_do_resume(struct pci_dev *pdev)


       reply	other threads:[~2007-02-20  9:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070216213153.f6704ff5.akpm@linux-foundation.org>
     [not found] ` <45D6FE5A.1080603@gmail.com>
2007-02-20  9:14   ` Tejun Heo [this message]
2007-02-20 16:02     ` [PATCH] libata: disable pdev on all suspend events Jeff Garzik

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=45DABC08.9030607@gmail.com \
    --to=htejun@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=greg@kroah.com \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=pavel@suse.cz \
    /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;
as well as URLs for NNTP newsgroup(s).