Skip to content

Commit

Permalink
virtio: console: Reference counting portdev structs is not needed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Amit Shah authored and Rusty Russell committed Oct 21, 2010
1 parent b353a6b commit e062013
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e062013

Please sign in to comment.