From: Amit Shah Date: Thu, 2 Sep 2010 13:08:29 +0000 (+0530) Subject: virtio: console: Add reference counting for port struct X-Git-Tag: v2.6.37-rc1~219^2~6 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b353a6b821627053f82b4e7b907e824cb7a6879c;p=pandora-kernel.git virtio: console: Add reference counting for port struct When a port got hot-unplugged, when a port was open, any file operation after the unplugging resulted in a crash. This is fixed by ref-counting the port structure, and releasing it only when the file is closed. This splits the unplug operation in two parts: first marks the port as unavailable, removes all the buffers in the vqs and removes the port from the per-device list of ports. The second stage, invoked when all references drop to zero, releases the chardev and frees all other memory. Signed-off-by: Amit Shah Signed-off-by: Rusty Russell --- Reading git-diff-tree failed