From: Amit Shah Date: Thu, 2 Sep 2010 13:08:30 +0000 (+0530) Subject: virtio: console: Reference counting portdev structs is not needed X-Git-Tag: v2.6.37-rc1~219^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e062013c7d22e40ee634b818d28fd615db36998e;p=platform%2Fupstream%2Fkernel-adaptation-pc.git virtio: console: Reference counting portdev structs is not needed 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 Signed-off-by: Rusty Russell --- diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 288701c..c84486b 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -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;