diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-10-22 12:52:58 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-10-24 15:27:21 +0200 |
commit | c39860e6dc90f6ee2e82ee078f978c5d7f3df86a (patch) | |
tree | 7af723a578b9f33ee172254b20fd9bbdd519cd0c /hw/char/xen_console.c | |
parent | 5d300164d00cf9d37a4481831d2c993255dfa0e8 (diff) |
char: replace qemu_chr_claim/release with qemu_chr_fe_init/deinit
Now that all front end use qemu_chr_fe_init(), we can move chardev
claiming in init(), and add a function deinit() to release the chardev
and cleanup handlers.
The qemu_chr_fe_claim_no_fail() for property are gone, since the
property will raise an error instead. In other cases, where there is
already an error path, an error is raised instead. Finally, other cases
are handled by &error_abort in qemu_chr_fe_init().
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20161022095318.17775-19-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/char/xen_console.c')
-rw-r--r-- | hw/char/xen_console.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c index 5e5aca1ed6..f664366f7c 100644 --- a/hw/char/xen_console.c +++ b/hw/char/xen_console.c @@ -245,15 +245,8 @@ static int con_initialise(struct XenDevice *xendev) xen_be_bind_evtchn(&con->xendev); if (con->chr.chr) { - if (qemu_chr_fe_claim(con->chr.chr) == 0) { - qemu_chr_fe_set_handlers(&con->chr, xencons_can_receive, - xencons_receive, NULL, con, NULL); - } else { - xen_be_printf(xendev, 0, - "xen_console_init error chardev %s already used\n", - con->chr.chr->label); - con->chr.chr = NULL; - } + qemu_chr_fe_set_handlers(&con->chr, xencons_can_receive, + xencons_receive, NULL, con, NULL); } xen_be_printf(xendev, 1, "ring mfn %d, remote port %d, local port %d, limit %zd\n", @@ -268,10 +261,7 @@ static void con_disconnect(struct XenDevice *xendev) { struct XenConsole *con = container_of(xendev, struct XenConsole, xendev); - if (con->chr.chr) { - qemu_chr_fe_set_handlers(&con->chr, NULL, NULL, NULL, NULL, NULL); - qemu_chr_fe_release(con->chr.chr); - } + qemu_chr_fe_deinit(&con->chr); xen_be_unbind_evtchn(&con->xendev); if (con->sring) { |