diff options
author | Amit Shah <amit.shah@redhat.com> | 2010-09-02 08:41:49 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-10-21 03:14:02 -0400 |
commit | 6bdf2afd02ae12bf8ac93e6d14c4b4dfef7c4c59 (patch) | |
tree | d7c1dafac07ee5cc10e526ff867f0d5d106a8033 /drivers/char/virtio_console.c | |
parent | 8ad37e83c8dc413f92b10c3d9bdeabe9237f521d (diff) |
virtio: console: Add a list of portdevs that are active
The virtio_console.c driver is capable of handling multiple devices at a
time. Maintain a list of devices for future traversal.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/char/virtio_console.c')
-rw-r--r-- | drivers/char/virtio_console.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 2f4f0b23ea00..b70fe96c1ccd 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -48,6 +48,9 @@ struct ports_driver_data { | |||
48 | /* Used for exporting per-port information to debugfs */ | 48 | /* Used for exporting per-port information to debugfs */ |
49 | struct dentry *debugfs_dir; | 49 | struct dentry *debugfs_dir; |
50 | 50 | ||
51 | /* List of all the devices we're handling */ | ||
52 | struct list_head portdevs; | ||
53 | |||
51 | /* Number of devices this driver is handling */ | 54 | /* Number of devices this driver is handling */ |
52 | unsigned int index; | 55 | unsigned int index; |
53 | 56 | ||
@@ -108,6 +111,9 @@ struct port_buffer { | |||
108 | * ports for that device (vdev->priv). | 111 | * ports for that device (vdev->priv). |
109 | */ | 112 | */ |
110 | struct ports_device { | 113 | struct ports_device { |
114 | /* Next portdev in the list, head is in the pdrvdata struct */ | ||
115 | struct list_head list; | ||
116 | |||
111 | /* | 117 | /* |
112 | * Workqueue handlers where we process deferred work after | 118 | * Workqueue handlers where we process deferred work after |
113 | * notification | 119 | * notification |
@@ -1599,6 +1605,10 @@ static int __devinit virtcons_probe(struct virtio_device *vdev) | |||
1599 | add_port(portdev, 0); | 1605 | add_port(portdev, 0); |
1600 | } | 1606 | } |
1601 | 1607 | ||
1608 | spin_lock_irq(&pdrvdata_lock); | ||
1609 | list_add_tail(&portdev->list, &pdrvdata.portdevs); | ||
1610 | spin_unlock_irq(&pdrvdata_lock); | ||
1611 | |||
1602 | __send_control_msg(portdev, VIRTIO_CONSOLE_BAD_ID, | 1612 | __send_control_msg(portdev, VIRTIO_CONSOLE_BAD_ID, |
1603 | VIRTIO_CONSOLE_DEVICE_READY, 1); | 1613 | VIRTIO_CONSOLE_DEVICE_READY, 1); |
1604 | return 0; | 1614 | return 0; |
@@ -1625,6 +1635,10 @@ static void virtcons_remove(struct virtio_device *vdev) | |||
1625 | 1635 | ||
1626 | portdev = vdev->priv; | 1636 | portdev = vdev->priv; |
1627 | 1637 | ||
1638 | spin_lock_irq(&pdrvdata_lock); | ||
1639 | list_del(&portdev->list); | ||
1640 | spin_unlock_irq(&pdrvdata_lock); | ||
1641 | |||
1628 | /* Disable interrupts for vqs */ | 1642 | /* Disable interrupts for vqs */ |
1629 | vdev->config->reset(vdev); | 1643 | vdev->config->reset(vdev); |
1630 | /* Finish up work that's lined up */ | 1644 | /* Finish up work that's lined up */ |
@@ -1691,6 +1705,7 @@ static int __init init(void) | |||
1691 | PTR_ERR(pdrvdata.debugfs_dir)); | 1705 | PTR_ERR(pdrvdata.debugfs_dir)); |
1692 | } | 1706 | } |
1693 | INIT_LIST_HEAD(&pdrvdata.consoles); | 1707 | INIT_LIST_HEAD(&pdrvdata.consoles); |
1708 | INIT_LIST_HEAD(&pdrvdata.portdevs); | ||
1694 | 1709 | ||
1695 | return register_virtio_driver(&virtio_console); | 1710 | return register_virtio_driver(&virtio_console); |
1696 | } | 1711 | } |