mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wu Zhangjin <wuzhangjin@gmail.com>
To: linux-pm@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org, len.brown@intel.com, pavel@ucw.cz,
	zhangfx@lemote.com, wuzj@lemote.com, yanh@lemote.com,
	Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [PATCH] [suspend] pci_raw_set_power_state: replace msleep by udelay in resuming procedure
Date: Thu, 16 Jul 2009 23:43:27 +0800	[thread overview]
Message-ID: <1247759007-27411-1-git-send-email-wuzhangjin@gmail.com> (raw)

we can not call msleep() when resuming from STR/Standby: if the
current_state of the pci device is PCI_D3hot, means we are in the
procedure of resuming, in this procedure, we can not re-schedule,
otherwise, there will be a deadlock.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
 drivers/pci/pci.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 440f4fb..3d9a4e2 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -497,8 +497,18 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
 
 	/* Mandatory power management transition delays */
 	/* see PCI PM 1.1 5.6.1 table 18 */
-	if (state == PCI_D3hot || dev->current_state == PCI_D3hot)
+
+	/* we can not call msleep() when resume:
+	 *
+	 *   if the current_state is PCI_D3hot, means we are in the procedure
+	 *   of resuming, in this procedure, we can not re-schedule, otherwise,
+	 *   there will be a deadlock.
+	 */
+
+	if (state == PCI_D3hot)
 		msleep(pci_pm_d3_delay);
+	else if (dev->current_state == PCI_D3hot)
+		udelay(pci_pm_d3_delay);
 	else if (state == PCI_D2 || dev->current_state == PCI_D2)
 		udelay(PCI_PM_D2_DELAY);
 
-- 
1.6.2.1


             reply	other threads:[~2009-07-16 15:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-16 15:43 Wu Zhangjin [this message]
2009-07-16 17:02 ` [linux-pm] " Alan Stern
2009-07-17  2:10   ` Wu Zhangjin
2009-07-17  2:18     ` Wu Zhangjin
2009-07-17  2:33     ` Rafael J. Wysocki
2009-07-17  3:38       ` Wu Zhangjin
2009-07-22  2:23       ` Wu Zhangjin
2009-07-22  7:10         ` 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=1247759007-27411-1-git-send-email-wuzhangjin@gmail.com \
    --to=wuzhangjin@gmail.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=pavel@ucw.cz \
    --cc=wuzj@lemote.com \
    --cc=yanh@lemote.com \
    --cc=zhangfx@lemote.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

all inboxes | Powered by JetHome®