aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-10-22 12:52:58 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2016-10-24 15:27:21 +0200
commitc39860e6dc90f6ee2e82ee078f978c5d7f3df86a (patch)
tree7af723a578b9f33ee172254b20fd9bbdd519cd0c /backends
parent5d300164d00cf9d37a4481831d2c993255dfa0e8 (diff)
downloadqemu-arm-c39860e6dc90f6ee2e82ee078f978c5d7f3df86a.tar.gz
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 'backends')
-rw-r--r--backends/rng-egd.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/backends/rng-egd.c b/backends/rng-egd.c
index d9e50bb085..433f583f78 100644
--- a/backends/rng-egd.c
+++ b/backends/rng-egd.c
@@ -100,10 +100,6 @@ static void rng_egd_opened(RngBackend *b, Error **errp)
"Device '%s' not found", s->chr_name);
return;
}
- if (qemu_chr_fe_claim(chr) != 0) {
- error_setg(errp, QERR_DEVICE_IN_USE, s->chr_name);
- return;
- }
if (!qemu_chr_fe_init(&s->chr, chr, errp)) {
return;
}
@@ -149,11 +145,7 @@ static void rng_egd_finalize(Object *obj)
{
RngEgd *s = RNG_EGD(obj);
- if (s->chr.chr) {
- qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, NULL, NULL, NULL);
- qemu_chr_fe_release(s->chr.chr);
- }
-
+ qemu_chr_fe_deinit(&s->chr);
g_free(s->chr_name);
}