serial: 8250_pnp: Enable PNP_CONSOLE for console ports
authorPeter Hurley <peter@hurleysoftware.com>
Thu, 22 Jan 2015 16:50:25 +0000 (11:50 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Feb 2015 18:11:25 +0000 (10:11 -0800)
When the kernel command line parameter, no_console_suspend, is used,
the console should continue to output console messages during and
after system suspend. For a serial console, the serial core ensures
that the device is not shutdown when no_console_suspend is specified.
However, the default operation of the pnp bus will disable and suspend
the device and no further output occurs.

When registering the 8250 port, if the serial device is a console
set the PNP_CONSOLE capability, which prevents device power-off
if consoles are not suspending.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_pnp.c

index 682a2fbe5c065be61c350088c86f16ba5a89ceff..50a09cd76d50a1d0b4709f5e487361ab76ac0ded 100644 (file)
@@ -426,7 +426,7 @@ static int serial_pnp_guess_board(struct pnp_dev *dev)
 static int
 serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 {
-       struct uart_8250_port uart;
+       struct uart_8250_port uart, *port;
        int ret, line, flags = dev_id->driver_data;
 
        if (flags & UNKNOWN_DEV) {
@@ -471,6 +471,10 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
        if (line < 0 || (flags & CIR_PORT))
                return -ENODEV;
 
+       port = serial8250_get_port(line);
+       if (uart_console(&port->port))
+               dev->capabilities |= PNP_CONSOLE;
+
        pnp_set_drvdata(dev, (void *)((long)line + 1));
        return 0;
 }
@@ -478,6 +482,8 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 static void serial_pnp_remove(struct pnp_dev *dev)
 {
        long line = (long)pnp_get_drvdata(dev);
+
+       dev->capabilities &= ~PNP_CONSOLE;
        if (line)
                serial8250_unregister_port(line - 1);
 }