Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 284247
b: refs/heads/master
c: 2b8f41d
h: refs/heads/master
i:
  284245: ab63b6a
  284243: 4bf02df
  284239: b8de77c
v: v3
  • Loading branch information
Amit Shah authored and Rusty Russell committed Jan 12, 2012
1 parent cd5118e commit 935b357
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a0e2dbfc223028b72a1c193f94fcd3f67253ba4a
refs/heads/master: 2b8f41d846990c3c1c8addbaed2cf53c3ef91d25
58 changes: 58 additions & 0 deletions trunk/drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -1844,6 +1844,60 @@ static unsigned int features[] = {
VIRTIO_CONSOLE_F_MULTIPORT,
};

#ifdef CONFIG_PM
static int virtcons_freeze(struct virtio_device *vdev)
{
struct ports_device *portdev;
struct port *port;

portdev = vdev->priv;

vdev->config->reset(vdev);

cancel_work_sync(&portdev->control_work);
remove_controlq_data(portdev);

list_for_each_entry(port, &portdev->ports, list) {
/*
* We'll ask the host later if the new invocation has
* the port opened or closed.
*/
port->host_connected = false;
remove_port_data(port);
}
remove_vqs(portdev);

return 0;
}

static int virtcons_restore(struct virtio_device *vdev)
{
struct ports_device *portdev;
struct port *port;
int ret;

portdev = vdev->priv;

ret = init_vqs(portdev);
if (ret)
return ret;

if (use_multiport(portdev))
fill_queue(portdev->c_ivq, &portdev->cvq_lock);

list_for_each_entry(port, &portdev->ports, list) {
port->in_vq = portdev->in_vqs[port->id];
port->out_vq = portdev->out_vqs[port->id];

fill_queue(port->in_vq, &port->inbuf_lock);

/* Get port open/close status on the host */
send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 1);
}
return 0;
}
#endif

static struct virtio_driver virtio_console = {
.feature_table = features,
.feature_table_size = ARRAY_SIZE(features),
Expand All @@ -1853,6 +1907,10 @@ static struct virtio_driver virtio_console = {
.probe = virtcons_probe,
.remove = virtcons_remove,
.config_changed = config_intr,
#ifdef CONFIG_PM
.freeze = virtcons_freeze,
.restore = virtcons_restore,
#endif
};

static int __init init(void)
Expand Down

0 comments on commit 935b357

Please sign in to comment.