mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: shuox.liu@intel.com
To: linux-kernel@vger.kernel.org
Cc: rafael.j.wysocki@intel.com, bhelgaas@google.com,
	yanmin_zhang@linux.intel.com, yanmin.zhang@intel.com
Subject: [PATCH] pnp: Bypass the calling to pnp_stop_dev at suspend when there is a protocol suspend
Date: Tue, 24 Dec 2013 09:35:51 +0800	[thread overview]
Message-ID: <1387848951-26999-1-git-send-email-shuox.liu@intel.com> (raw)

From: Zhang Yanmin <yanmin.zhang@intel.com>

pnp pnp_bus_suspend/_resume have an issue.
pnp_bus_suspend calls pnp_stop_dev to disable the device. With ACPI,
pnp_stop_dev turns off the dev usually. Then,
pnp_bus_suspend=>pnp_dev->protocol->suspend accesses the device and
suspend it again.

pnp_bus_resume has the similar issue.

Another issue is firmware might just provide _DIS, but no_STS method.

The patch fixes it by adding a checking. If there is
pnp_dev->protocol->suspend, pnp_bus_suspend doesn't call pnp_stop_dev.
Do the similar thing for _resume.

Signed-off-by: Zhang Yanmin <yanmin.zhang@intel.com>
Signed-off-by: Liu ShuoX <shuox.liu@intel.com>
---
 drivers/pnp/driver.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index f748cc8..2512e47 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -176,7 +176,7 @@ static int __pnp_bus_suspend(struct device *dev, pm_message_t state)
 			return error;
 	}
 
-	if (pnp_can_disable(pnp_dev)) {
+	if (pnp_can_disable(pnp_dev) && !pnp_dev->protocol->suspend) {
 		error = pnp_stop_dev(pnp_dev);
 		if (error)
 			return error;
@@ -215,9 +215,7 @@ static int pnp_bus_resume(struct device *dev)
 		error = pnp_dev->protocol->resume(pnp_dev);
 		if (error)
 			return error;
-	}
-
-	if (pnp_can_write(pnp_dev)) {
+	} else if (pnp_can_write(pnp_dev)) {
 		error = pnp_start_dev(pnp_dev);
 		if (error)
 			return error;
-- 
1.8.3


             reply	other threads:[~2013-12-24  1:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-24  1:35 shuox.liu [this message]
2014-01-06  1:20 ` Yanmin Zhang
2014-01-06  1:35   ` Rafael J. Wysocki

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=1387848951-26999-1-git-send-email-shuox.liu@intel.com \
    --to=shuox.liu@intel.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=yanmin.zhang@intel.com \
    --cc=yanmin_zhang@linux.intel.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®