aboutsummaryrefslogtreecommitdiff
path: root/qemu-char.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-03-26 11:07:57 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2013-03-27 10:26:49 -0500
commit8e25daa87ac98c9070365b42dcfc070e47fca934 (patch)
tree31c74f981117295571ac28d353e8512b8fcc30e2 /qemu-char.c
parent190832289fe670f764fb277e4dcaf00f94ca6553 (diff)
qemu-char: Cleanup: consolidate fe_open/fe_close into fe_set_open
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Message-id: 1364292483-16564-6-git-send-email-hdegoede@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 947541a559..29a24628ed 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -238,11 +238,7 @@ void qemu_chr_add_handlers(CharDriverState *s,
s->chr_update_read_handler(s);
if (!s->explicit_fe_open) {
- if (fe_open) {
- qemu_chr_fe_open(s);
- } else {
- qemu_chr_fe_close(s);
- }
+ qemu_chr_fe_set_open(s, fe_open);
}
/* We're connecting to an already opened device, so let's make sure we
@@ -3423,24 +3419,16 @@ void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo)
}
}
-void qemu_chr_fe_open(struct CharDriverState *chr)
+void qemu_chr_fe_set_open(struct CharDriverState *chr, int fe_open)
{
- if (chr->fe_open) {
+ if (chr->fe_open == fe_open) {
return;
}
- chr->fe_open = 1;
- if (chr->chr_guest_open) {
+ chr->fe_open = fe_open;
+ if (fe_open && chr->chr_guest_open) {
chr->chr_guest_open(chr);
}
-}
-
-void qemu_chr_fe_close(struct CharDriverState *chr)
-{
- if (!chr->fe_open) {
- return;
- }
- chr->fe_open = 0;
- if (chr->chr_guest_close) {
+ if (!fe_open && chr->chr_guest_close) {
chr->chr_guest_close(chr);
}
}