提交 2c7faf31 编写于 作者: S Samuel Thibault 提交者: Aurelien Jarno

baum: add destroy hook

Add a destroy hook for the baum character device, to properly close the BrlAPI
connection.
Signed-off-by: NSamuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
上级 8e31209e
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册