]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
PNP: Allow console to override ACPI device sleep
authorPeter Hurley <peter@hurleysoftware.com>
Thu, 22 Jan 2015 16:50:24 +0000 (11:50 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Feb 2015 18:11:25 +0000 (10:11 -0800)
If the serial console is an ACPI PNP device, the PNP bus always powers
down the device at system suspend, even though the no_console_suspend
command line parameter is specified (eg., when debugging suspend/resume).

Add PNP_CONSOLE capability, which when set, prevents calling both the
->disable() and ->suspend() PNP protocol methods if console suspend
is disabled.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pnp/driver.c
include/linux/pnp.h

index f748cc8cbb031cf3ad3fd943688fc6172a452bd2..4e57d3370368f597bb27ed4bcc4693153ce0e0de 100644 (file)
@@ -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;
 }
index 195aafc6cd07c691e37e7d0247538dbd63ff5360..6512e9cbc6d57ca6abe80cc61a15db606c240cb7 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/list.h>
 #include <linux/errno.h>
 #include <linux/mod_devicetable.h>
+#include <linux/console.h>
 
 #define PNP_NAME_LEN           50
 
@@ -309,15 +310,22 @@ struct pnp_fixup {
 #define PNP_DISABLE            0x0004
 #define PNP_CONFIGURABLE       0x0008
 #define PNP_REMOVABLE          0x0010
+#define PNP_CONSOLE            0x0020
 
 #define pnp_can_read(dev)      (((dev)->protocol->get) && \
                                 ((dev)->capabilities & PNP_READ))
 #define pnp_can_write(dev)     (((dev)->protocol->set) && \
                                 ((dev)->capabilities & PNP_WRITE))
-#define pnp_can_disable(dev)   (((dev)->protocol->disable) && \
-                                ((dev)->capabilities & PNP_DISABLE))
+#define pnp_can_disable(dev)   (((dev)->protocol->disable) &&            \
+                                ((dev)->capabilities & PNP_DISABLE) &&   \
+                                (!((dev)->capabilities & PNP_CONSOLE) || \
+                                 console_suspend_enabled))
 #define pnp_can_configure(dev) ((!(dev)->active) && \
                                 ((dev)->capabilities & PNP_CONFIGURABLE))
+#define pnp_can_suspend(dev)   (((dev)->protocol->suspend) &&            \
+                                (!((dev)->capabilities & PNP_CONSOLE) || \
+                                 console_suspend_enabled))
+
 
 #ifdef CONFIG_ISAPNP
 extern struct pnp_protocol isapnp_protocol;