aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2010-05-20 00:15:48 -0400
committerRusty Russell <rusty@rustcorp.com.au>2010-05-19 08:45:48 -0400
commit99f905f88a5b8478755605e08ed4bce40034cc6c (patch)
tree783437bf2f8fb0b92dec5292adda589b2a176700 /drivers
parent69eb9a9f69572c0ebe08a0a46f56bdfdcdaa19a0 (diff)
virtio: console: Remove config work handler
We're going to switch to using control messages for port hot-plug and initial port discovery. Remove the config work handler which handled port hot-plug so far. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/virtio_console.c64
1 files changed, 1 insertions, 63 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 9a698707e14b..e1f92a0c5c5f 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -110,7 +110,6 @@ struct ports_device {
110 * notification 110 * notification
111 */ 111 */
112 struct work_struct control_work; 112 struct work_struct control_work;
113 struct work_struct config_work;
114 113
115 struct list_head ports; 114 struct list_head ports;
116 115
@@ -1084,10 +1083,7 @@ static void config_intr(struct virtio_device *vdev)
1084 struct ports_device *portdev; 1083 struct ports_device *portdev;
1085 1084
1086 portdev = vdev->priv; 1085 portdev = vdev->priv;
1087 if (use_multiport(portdev)) { 1086
1088 /* Handle port hot-add */
1089 schedule_work(&portdev->config_work);
1090 }
1091 /* 1087 /*
1092 * We'll use this way of resizing only for legacy support. 1088 * We'll use this way of resizing only for legacy support.
1093 * For newer userspace (VIRTIO_CONSOLE_F_MULTPORT+), use 1089 * For newer userspace (VIRTIO_CONSOLE_F_MULTPORT+), use
@@ -1230,62 +1226,6 @@ fail:
1230 return err; 1226 return err;
1231} 1227}
1232 1228
1233/*
1234 * The workhandler for config-space updates.
1235 *
1236 * This is called when ports are hot-added.
1237 */
1238static void config_work_handler(struct work_struct *work)
1239{
1240 struct virtio_console_config virtconconf;
1241 struct ports_device *portdev;
1242 struct virtio_device *vdev;
1243 int err;
1244
1245 portdev = container_of(work, struct ports_device, config_work);
1246
1247 vdev = portdev->vdev;
1248 vdev->config->get(vdev,
1249 offsetof(struct virtio_console_config, nr_ports),
1250 &virtconconf.nr_ports,
1251 sizeof(virtconconf.nr_ports));
1252
1253 if (portdev->config.nr_ports == virtconconf.nr_ports) {
1254 /*
1255 * Port 0 got hot-added. Since we already did all the
1256 * other initialisation for it, just tell the Host
1257 * that the port is ready if we find the port. In
1258 * case the port was hot-removed earlier, we call
1259 * add_port to add the port.
1260 */
1261 struct port *port;
1262
1263 port = find_port_by_id(portdev, 0);
1264 if (!port)
1265 add_port(portdev, 0);
1266 else
1267 send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 1);
1268 return;
1269 }
1270 if (virtconconf.nr_ports > portdev->config.max_nr_ports) {
1271 dev_warn(&vdev->dev,
1272 "More ports specified (%u) than allowed (%u)",
1273 portdev->config.nr_ports + 1,
1274 portdev->config.max_nr_ports);
1275 return;
1276 }
1277 if (virtconconf.nr_ports < portdev->config.nr_ports)
1278 return;
1279
1280 /* Hot-add ports */
1281 while (virtconconf.nr_ports - portdev->config.nr_ports) {
1282 err = add_port(portdev, portdev->config.nr_ports);
1283 if (err)
1284 break;
1285 portdev->config.nr_ports++;
1286 }
1287}
1288
1289static int init_vqs(struct ports_device *portdev) 1229static int init_vqs(struct ports_device *portdev)
1290{ 1230{
1291 vq_callback_t **io_callbacks; 1231 vq_callback_t **io_callbacks;
@@ -1478,7 +1418,6 @@ static int __devinit virtcons_probe(struct virtio_device *vdev)
1478 1418
1479 spin_lock_init(&portdev->cvq_lock); 1419 spin_lock_init(&portdev->cvq_lock);
1480 INIT_WORK(&portdev->control_work, &control_work_handler); 1420 INIT_WORK(&portdev->control_work, &control_work_handler);
1481 INIT_WORK(&portdev->config_work, &config_work_handler);
1482 1421
1483 nr_added_bufs = fill_queue(portdev->c_ivq, &portdev->cvq_lock); 1422 nr_added_bufs = fill_queue(portdev->c_ivq, &portdev->cvq_lock);
1484 if (!nr_added_bufs) { 1423 if (!nr_added_bufs) {
@@ -1521,7 +1460,6 @@ static void virtcons_remove(struct virtio_device *vdev)
1521 portdev = vdev->priv; 1460 portdev = vdev->priv;
1522 1461
1523 cancel_work_sync(&portdev->control_work); 1462 cancel_work_sync(&portdev->control_work);
1524 cancel_work_sync(&portdev->config_work);
1525 1463
1526 list_for_each_entry_safe(port, port2, &portdev->ports, list) 1464 list_for_each_entry_safe(port, port2, &portdev->ports, list)
1527 remove_port(port); 1465 remove_port(port);