diff options
author | Samuel Thibault <samuel.thibault@gnu.org> | 2010-03-28 20:39:42 +0200 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2010-04-08 21:17:10 +0200 |
commit | b31feefd902adee3ff4602f13c5963372cf211d0 (patch) | |
tree | b132b28cd9d4a2cf644475ef837f67667df8b9b0 /hw/baum.c | |
parent | c164e11c5b38d7ad6980dbfdf0013d130f1f6f24 (diff) | |
download | qemu-b31feefd902adee3ff4602f13c5963372cf211d0.tar.gz qemu-b31feefd902adee3ff4602f13c5963372cf211d0.tar.bz2 qemu-b31feefd902adee3ff4602f13c5963372cf211d0.zip |
baum: add destroy hook
Add a destroy hook for the baum character device, to properly close the BrlAPI
connection.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw/baum.c')
-rw-r--r-- | hw/baum.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -564,6 +564,18 @@ static void baum_chr_read(void *opaque) } } +static void baum_close(struct CharDriverState *chr) +{ + BaumDriverState *baum = chr->opaque; + + qemu_free_timer(baum->cellCount_timer); + if (baum->brlapi) { + brlapi__closeConnection(baum->brlapi); + qemu_free(baum->brlapi); + } + qemu_free(baum); +} + CharDriverState *chr_baum_init(QemuOpts *opts) { BaumDriverState *baum; @@ -581,6 +593,7 @@ CharDriverState *chr_baum_init(QemuOpts *opts) chr->chr_write = baum_write; chr->chr_send_event = baum_send_event; chr->chr_accept_input = baum_accept_input; + chr->chr_close = baum_close; handle = qemu_mallocz(brlapi_getHandleSize()); baum->brlapi = handle; |