diff options
Diffstat (limited to 'drivers/char/virtio_console.c')
-rw-r--r-- | drivers/char/virtio_console.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 8c99bf1b5e9f..942a9826bd23 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -529,6 +529,10 @@ static bool will_write_block(struct port *port) | |||
529 | { | 529 | { |
530 | bool ret; | 530 | bool ret; |
531 | 531 | ||
532 | if (!port->guest_connected) { | ||
533 | /* Port got hot-unplugged. Let's exit. */ | ||
534 | return false; | ||
535 | } | ||
532 | if (!port->host_connected) | 536 | if (!port->host_connected) |
533 | return true; | 537 | return true; |
534 | 538 | ||
@@ -1099,6 +1103,13 @@ static int remove_port(struct port *port) | |||
1099 | { | 1103 | { |
1100 | struct port_buffer *buf; | 1104 | struct port_buffer *buf; |
1101 | 1105 | ||
1106 | if (port->guest_connected) { | ||
1107 | port->guest_connected = false; | ||
1108 | port->host_connected = false; | ||
1109 | wake_up_interruptible(&port->waitqueue); | ||
1110 | send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 0); | ||
1111 | } | ||
1112 | |||
1102 | spin_lock_irq(&port->portdev->ports_lock); | 1113 | spin_lock_irq(&port->portdev->ports_lock); |
1103 | list_del(&port->list); | 1114 | list_del(&port->list); |
1104 | spin_unlock_irq(&port->portdev->ports_lock); | 1115 | spin_unlock_irq(&port->portdev->ports_lock); |
@@ -1120,9 +1131,6 @@ static int remove_port(struct port *port) | |||
1120 | hvc_remove(port->cons.hvc); | 1131 | hvc_remove(port->cons.hvc); |
1121 | #endif | 1132 | #endif |
1122 | } | 1133 | } |
1123 | if (port->guest_connected) | ||
1124 | send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 0); | ||
1125 | |||
1126 | sysfs_remove_group(&port->dev->kobj, &port_attribute_group); | 1134 | sysfs_remove_group(&port->dev->kobj, &port_attribute_group); |
1127 | device_destroy(pdrvdata.class, port->dev->devt); | 1135 | device_destroy(pdrvdata.class, port->dev->devt); |
1128 | cdev_del(&port->cdev); | 1136 | cdev_del(&port->cdev); |