mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
char: avoid chardevice direct access
frontends should avoid accessing CharDriver struct where possible Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1499342940-56739-6-git-send-email-anton.nefedov@virtuozzo.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
7c44a2a9d1
commit
3065070153
24 changed files with 41 additions and 32 deletions
|
@ -484,13 +484,12 @@ static void usb_serial_realize(USBDevice *dev, Error **errp)
|
|||
{
|
||||
USBSerialState *s = USB_SERIAL_DEV(dev);
|
||||
Error *local_err = NULL;
|
||||
Chardev *chr = qemu_chr_fe_get_driver(&s->cs);
|
||||
|
||||
usb_desc_create_serial(dev);
|
||||
usb_desc_init(dev);
|
||||
dev->auto_attach = 0;
|
||||
|
||||
if (!chr) {
|
||||
if (!qemu_chr_fe_backend_connected(&s->cs)) {
|
||||
error_setg(errp, "Property chardev is required");
|
||||
return;
|
||||
}
|
||||
|
@ -505,7 +504,7 @@ static void usb_serial_realize(USBDevice *dev, Error **errp)
|
|||
usb_serial_event, NULL, s, NULL, true);
|
||||
usb_serial_handle_reset(dev);
|
||||
|
||||
if (chr->be_open && !dev->attached) {
|
||||
if (qemu_chr_fe_backend_open(&s->cs) && !dev->attached) {
|
||||
usb_device_attach(dev, &error_abort);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue