mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	Jiri Slaby <jslaby@suse.cz>,
	Peter Hurley <peter@hurleysoftware.com>
Subject: [PATCH 3/4] PNP: Allow device to override ACPI device sleep
Date: Wed,  5 Nov 2014 13:40:53 -0500	[thread overview]
Message-ID: <1415212854-16944-4-git-send-email-peter@hurleysoftware.com> (raw)
In-Reply-To: <1415212854-16944-1-git-send-email-peter@hurleysoftware.com>

If the serial console is an ACPI PNP device, the PNP bus attempts to
power-down the device, even though the no_console_suspend command line
parameter is specified (eg., debugging suspend/resume).

Add PNP_SUSPEND capability which is on by default, but when cleared,
prevents pnpacpi_suspend() (which is the ACPI PNP protocol ->suspend()
method).

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/pnp/driver.c       | 2 +-
 drivers/pnp/pnpacpi/core.c | 2 +-
 include/linux/pnp.h        | 3 +++
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index f748cc8..4e57d33 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -182,7 +182,7 @@ static int __pnp_bus_suspend(struct device *dev, pm_message_t state)
 			return error;
 	}
 
-	if (pnp_dev->protocol->suspend)
+	if (pnp_can_suspend(pnp_dev))
 		pnp_dev->protocol->suspend(pnp_dev, state);
 	return 0;
 }
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index d2b780a..115bb73 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -253,7 +253,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
 	dev->active = device->status.enabled;
 	if (acpi_has_method(device->handle, "_SRS"))
 		dev->capabilities |= PNP_CONFIGURABLE;
-	dev->capabilities |= PNP_READ;
+	dev->capabilities |= PNP_READ | PNP_SUSPEND;
 	if (device->flags.dynamic_status && (dev->capabilities & PNP_CONFIGURABLE))
 		dev->capabilities |= PNP_WRITE;
 	if (device->flags.removable)
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 195aafc..5a5cbc2 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -309,6 +309,7 @@ struct pnp_fixup {
 #define PNP_DISABLE		0x0004
 #define PNP_CONFIGURABLE	0x0008
 #define PNP_REMOVABLE		0x0010
+#define PNP_SUSPEND		0x0020
 
 #define pnp_can_read(dev)	(((dev)->protocol->get) && \
 				 ((dev)->capabilities & PNP_READ))
@@ -318,6 +319,8 @@ struct pnp_fixup {
 				 ((dev)->capabilities & PNP_DISABLE))
 #define pnp_can_configure(dev)	((!(dev)->active) && \
 				 ((dev)->capabilities & PNP_CONFIGURABLE))
+#define pnp_can_suspend(dev)	(((dev)->protocol->suspend) && \
+				 ((dev)->capabilities & PNP_SUSPEND))
 
 #ifdef CONFIG_ISAPNP
 extern struct pnp_protocol isapnp_protocol;
-- 
2.1.3


  parent reply	other threads:[~2014-11-05 18:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05 18:40 [PATCH 0/4] fix serial console suspend on PNP Peter Hurley
2014-11-05 18:40 ` [PATCH 1/4] serial: core: Simplify console suspend logic in uart_suspend_port() Peter Hurley
2014-11-05 18:40 ` [PATCH 2/4] serial: 8250_pnp: Override pnp disable for no_console_suspend Peter Hurley
2014-11-05 18:40 ` Peter Hurley [this message]
2014-11-05 22:28   ` [PATCH 3/4] PNP: Allow device to override ACPI device sleep Rafael J. Wysocki
2014-11-05 22:14     ` Peter Hurley
2014-11-05 18:40 ` [PATCH 4/4] serial: 8250_pnp: Override pnp suspend for no_console_suspend Peter Hurley
2014-11-05 18:45   ` Peter Hurley
2014-11-05 19:02   ` [PATCH v2 " Peter Hurley
2014-11-06 19:06 ` [PATCH 0/4] fix serial console suspend on PNP Greg Kroah-Hartman

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=1415212854-16944-4-git-send-email-peter@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=rafael.j.wysocki@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

Powered by JetHome