virtio: console: Reference counting portdev structs is not needed
authorAmit Shah <amit.shah@redhat.com>
Thu, 2 Sep 2010 13:08:30 +0000 (18:38 +0530)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 21 Oct 2010 07:14:03 +0000 (17:44 +1030)
Explain in a comment why there's no need to reference-count the portdev
struct: when a device is yanked out, we can't do anything more with it
anyway so just give up doing anything more with the data or the vqs and
exit cleanly.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/char/virtio_console.c

index 288701ccbf7a0219c9ea81ebd8cf59a14575191c..c84486b3e43d87a9f3d664861b5ed47e968eb157 100644 (file)
@@ -1738,6 +1738,14 @@ static void virtcons_remove(struct virtio_device *vdev)
 
        unregister_chrdev(portdev->chr_major, "virtio-portsdev");
 
+       /*
+        * When yanking out a device, we immediately lose the
+        * (device-side) queues.  So there's no point in keeping the
+        * guest side around till we drop our final reference.  This
+        * also means that any ports which are in an open state will
+        * have to just stop using the port, as the vqs are going
+        * away.
+        */
        if (use_multiport(portdev)) {
                struct port_buffer *buf;
                unsigned int len;