char: Allow devices to use a single multiplexed chardev.

This fixes regression caused by commit
2d6c1ef40f
("char: Prevent multiple devices opening same chardev"):

-nodefaults -nographic -chardev stdio,id=stdio,mux=on,signal=off \
 -mon stdio -device virtio-serial-pci \
 -device virtconsole,chardev=stdio -device isa-serial,chardev=stdio

fails with:

qemu-system-x86_64: -device isa-serial,chardev=stdio: Property 'isa-serial.chardev' can't take value 'stdio', it's in use

Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
This commit is contained in:
Kusanagi Kouichi 2011-04-26 19:19:26 +09:00 committed by Amit Shah
parent cd8f7df289
commit d5b27167e1
3 changed files with 7 additions and 4 deletions

View file

@ -354,10 +354,10 @@ static int parse_chr(DeviceState *dev, Property *prop, const char *str)
if (*ptr == NULL) {
return -ENOENT;
}
if ((*ptr)->assigned) {
if ((*ptr)->avail_connections < 1) {
return -EEXIST;
}
(*ptr)->assigned = 1;
--(*ptr)->avail_connections;
return 0;
}