From nobody Sun May 5 11:28:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487864651432365.3027951360857; Thu, 23 Feb 2017 07:44:11 -0800 (PST) Received: from localhost ([::1]:59408 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgvYw-0004JR-4L for importer@patchew.org; Thu, 23 Feb 2017 10:44:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgvVI-0000hm-4e for qemu-devel@nongnu.org; Thu, 23 Feb 2017 10:40:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgvVF-0006ns-6n for qemu-devel@nongnu.org; Thu, 23 Feb 2017 10:40:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57836) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgvVE-0006nB-Tz for qemu-devel@nongnu.org; Thu, 23 Feb 2017 10:40:21 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C6287FB7A for ; Thu, 23 Feb 2017 15:40:20 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1NFeImK015535; Thu, 23 Feb 2017 10:40:19 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id BA89680B6B; Thu, 23 Feb 2017 16:40:16 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 23 Feb 2017 16:40:12 +0100 Message-Id: <1487864414-25485-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1487864414-25485-1-git-send-email-kraxel@redhat.com> References: <1487864414-25485-1-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 23 Feb 2017 15:40:20 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/3] usb: replace handle_destroy with unrealize X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Curiously, unrealize() is not being used, but it seems more appropriate than handle_destroy() together with realize(). It is more ubiquitous destroy name in qemu code base and may throw errors. Cc: Gerd Hoffmann Signed-off-by: Marc-Andr=C3=A9 Lureau Message-id: 20170221141451.28305-25-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann --- hw/usb/bus.c | 9 +++++---- hw/usb/dev-audio.c | 4 ++-- hw/usb/dev-bluetooth.c | 4 ++-- hw/usb/dev-hid.c | 4 ++-- hw/usb/dev-hub.c | 4 ++-- hw/usb/dev-network.c | 4 ++-- hw/usb/dev-smartcard-reader.c | 4 ++-- hw/usb/dev-uas.c | 4 ++-- hw/usb/dev-wacom.c | 4 ++-- hw/usb/host-libusb.c | 4 ++-- hw/usb/redirect.c | 4 ++-- include/hw/usb.h | 5 ----- 12 files changed, 25 insertions(+), 29 deletions(-) diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 1dcc35c..efe4b8e 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -136,11 +136,12 @@ USBDevice *usb_device_find_device(USBDevice *dev, uin= t8_t addr) return NULL; } =20 -static void usb_device_handle_destroy(USBDevice *dev) +static void usb_device_unrealize(USBDevice *dev, Error **errp) { USBDeviceClass *klass =3D USB_DEVICE_GET_CLASS(dev); - if (klass->handle_destroy) { - klass->handle_destroy(dev); + + if (klass->unrealize) { + klass->unrealize(dev, errp); } } =20 @@ -291,7 +292,7 @@ static void usb_qdev_unrealize(DeviceState *qdev, Error= **errp) if (dev->attached) { usb_device_detach(dev); } - usb_device_handle_destroy(dev); + usb_device_unrealize(dev, errp); if (dev->port) { usb_release_port(dev); } diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index 87cab0a..3433452 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -617,7 +617,7 @@ static void usb_audio_handle_data(USBDevice *dev, USBPa= cket *p) } } =20 -static void usb_audio_handle_destroy(USBDevice *dev) +static void usb_audio_unrealize(USBDevice *dev, Error **errp) { USBAudioState *s =3D USB_AUDIO(dev); =20 @@ -683,7 +683,7 @@ static void usb_audio_class_init(ObjectClass *klass, vo= id *data) k->handle_reset =3D usb_audio_handle_reset; k->handle_control =3D usb_audio_handle_control; k->handle_data =3D usb_audio_handle_data; - k->handle_destroy =3D usb_audio_handle_destroy; + k->unrealize =3D usb_audio_unrealize; k->set_interface =3D usb_audio_set_interface; } =20 diff --git a/hw/usb/dev-bluetooth.c b/hw/usb/dev-bluetooth.c index 91a4a0b..443e3c3 100644 --- a/hw/usb/dev-bluetooth.c +++ b/hw/usb/dev-bluetooth.c @@ -496,7 +496,7 @@ static void usb_bt_out_hci_packet_acl(void *opaque, usb_bt_fifo_enqueue(&s->acl, data, len); } =20 -static void usb_bt_handle_destroy(USBDevice *dev) +static void usb_bt_unrealize(USBDevice *dev, Error **errp) { struct USBBtState *s =3D (struct USBBtState *) dev->opaque; =20 @@ -559,7 +559,7 @@ static void usb_bt_class_initfn(ObjectClass *klass, voi= d *data) uc->handle_reset =3D usb_bt_handle_reset; uc->handle_control =3D usb_bt_handle_control; uc->handle_data =3D usb_bt_handle_data; - uc->handle_destroy =3D usb_bt_handle_destroy; + uc->unrealize =3D usb_bt_unrealize; dc->vmsd =3D &vmstate_usb_bt; set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); } diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c index dda0bf0..c40019d 100644 --- a/hw/usb/dev-hid.c +++ b/hw/usb/dev-hid.c @@ -690,7 +690,7 @@ static void usb_hid_handle_data(USBDevice *dev, USBPack= et *p) } } =20 -static void usb_hid_handle_destroy(USBDevice *dev) +static void usb_hid_unrealize(USBDevice *dev, Error **errp) { USBHIDState *us =3D USB_HID(dev); =20 @@ -785,7 +785,7 @@ static void usb_hid_class_initfn(ObjectClass *klass, vo= id *data) uc->handle_reset =3D usb_hid_handle_reset; uc->handle_control =3D usb_hid_handle_control; uc->handle_data =3D usb_hid_handle_data; - uc->handle_destroy =3D usb_hid_handle_destroy; + uc->unrealize =3D usb_hid_unrealize; uc->handle_attach =3D usb_desc_attach; } =20 diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index a33f21c..9fe7333 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -497,7 +497,7 @@ static void usb_hub_handle_data(USBDevice *dev, USBPack= et *p) } } =20 -static void usb_hub_handle_destroy(USBDevice *dev) +static void usb_hub_unrealize(USBDevice *dev, Error **errp) { USBHubState *s =3D (USBHubState *)dev; int i; @@ -575,7 +575,7 @@ static void usb_hub_class_initfn(ObjectClass *klass, vo= id *data) uc->handle_reset =3D usb_hub_handle_reset; uc->handle_control =3D usb_hub_handle_control; uc->handle_data =3D usb_hub_handle_data; - uc->handle_destroy =3D usb_hub_handle_destroy; + uc->unrealize =3D usb_hub_unrealize; set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); dc->fw_name =3D "hub"; dc->vmsd =3D &vmstate_usb_hub; diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index c0f1193..85fc81b 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -1324,7 +1324,7 @@ static void usbnet_cleanup(NetClientState *nc) s->nic =3D NULL; } =20 -static void usb_net_handle_destroy(USBDevice *dev) +static void usb_net_unrealize(USBDevice *dev, Error **errp) { USBNetState *s =3D (USBNetState *) dev; =20 @@ -1428,7 +1428,7 @@ static void usb_net_class_initfn(ObjectClass *klass, = void *data) uc->handle_reset =3D usb_net_handle_reset; uc->handle_control =3D usb_net_handle_control; uc->handle_data =3D usb_net_handle_data; - uc->handle_destroy =3D usb_net_handle_destroy; + uc->unrealize =3D usb_net_unrealize; set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); dc->fw_name =3D "network"; dc->vmsd =3D &vmstate_usb_net; diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index 7cd4ed0..757b8b3 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -1163,7 +1163,7 @@ static void ccid_handle_data(USBDevice *dev, USBPacke= t *p) } } =20 -static void ccid_handle_destroy(USBDevice *dev) +static void ccid_unrealize(USBDevice *dev, Error **errp) { USBCCIDState *s =3D USB_CCID_DEV(dev); =20 @@ -1470,7 +1470,7 @@ static void ccid_class_initfn(ObjectClass *klass, voi= d *data) uc->handle_reset =3D ccid_handle_reset; uc->handle_control =3D ccid_handle_control; uc->handle_data =3D ccid_handle_data; - uc->handle_destroy =3D ccid_handle_destroy; + uc->unrealize =3D ccid_unrealize; dc->desc =3D "CCID Rev 1.1 smartcard reader"; dc->vmsd =3D &ccid_vmstate; dc->props =3D ccid_properties; diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c index da2fb70..3b26655 100644 --- a/hw/usb/dev-uas.c +++ b/hw/usb/dev-uas.c @@ -891,7 +891,7 @@ static void usb_uas_handle_data(USBDevice *dev, USBPack= et *p) } } =20 -static void usb_uas_handle_destroy(USBDevice *dev) +static void usb_uas_unrealize(USBDevice *dev, Error **errp) { UASDevice *uas =3D USB_UAS(dev); =20 @@ -944,7 +944,7 @@ static void usb_uas_class_initfn(ObjectClass *klass, vo= id *data) uc->handle_reset =3D usb_uas_handle_reset; uc->handle_control =3D usb_uas_handle_control; uc->handle_data =3D usb_uas_handle_data; - uc->handle_destroy =3D usb_uas_handle_destroy; + uc->unrealize =3D usb_uas_unrealize; uc->attached_settable =3D true; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); dc->fw_name =3D "storage"; diff --git a/hw/usb/dev-wacom.c b/hw/usb/dev-wacom.c index c4702db..bf70013 100644 --- a/hw/usb/dev-wacom.c +++ b/hw/usb/dev-wacom.c @@ -329,7 +329,7 @@ static void usb_wacom_handle_data(USBDevice *dev, USBPa= cket *p) } } =20 -static void usb_wacom_handle_destroy(USBDevice *dev) +static void usb_wacom_unrealize(USBDevice *dev, Error **errp) { USBWacomState *s =3D (USBWacomState *) dev; =20 @@ -364,7 +364,7 @@ static void usb_wacom_class_init(ObjectClass *klass, vo= id *data) uc->handle_reset =3D usb_wacom_handle_reset; uc->handle_control =3D usb_wacom_handle_control; uc->handle_data =3D usb_wacom_handle_data; - uc->handle_destroy =3D usb_wacom_handle_destroy; + uc->unrealize =3D usb_wacom_unrealize; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); dc->desc =3D "QEMU PenPartner Tablet"; dc->vmsd =3D &vmstate_usb_wacom; diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index 7791c6d..c9876a5 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -1065,7 +1065,7 @@ static void usb_host_instance_init(Object *obj) &udev->qdev, NULL); } =20 -static void usb_host_handle_destroy(USBDevice *udev) +static void usb_host_unrealize(USBDevice *udev, Error **errp) { USBHostDevice *s =3D USB_HOST_DEVICE(udev); =20 @@ -1568,7 +1568,7 @@ static void usb_host_class_initfn(ObjectClass *klass,= void *data) uc->handle_data =3D usb_host_handle_data; uc->handle_control =3D usb_host_handle_control; uc->handle_reset =3D usb_host_handle_reset; - uc->handle_destroy =3D usb_host_handle_destroy; + uc->unrealize =3D usb_host_unrealize; uc->flush_ep_queue =3D usb_host_flush_ep_queue; uc->alloc_streams =3D usb_host_alloc_streams; uc->free_streams =3D usb_host_free_streams; diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 860f5c3..0efe62f 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1427,7 +1427,7 @@ static void usbredir_cleanup_device_queues(USBRedirDe= vice *dev) } } =20 -static void usbredir_handle_destroy(USBDevice *udev) +static void usbredir_unrealize(USBDevice *udev, Error **errp) { USBRedirDevice *dev =3D USB_REDIRECT(udev); Chardev *chr =3D qemu_chr_fe_get_driver(&dev->cs); @@ -2513,7 +2513,7 @@ static void usbredir_class_initfn(ObjectClass *klass,= void *data) =20 uc->realize =3D usbredir_realize; uc->product_desc =3D "USB Redirection Device"; - uc->handle_destroy =3D usbredir_handle_destroy; + uc->unrealize =3D usbredir_unrealize; uc->cancel_packet =3D usbredir_cancel_packet; uc->handle_reset =3D usbredir_handle_reset; uc->handle_data =3D usbredir_handle_data; diff --git a/include/hw/usb.h b/include/hw/usb.h index c42b29c..eb28655 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -291,11 +291,6 @@ typedef struct USBDeviceClass { void (*cancel_packet)(USBDevice *dev, USBPacket *p); =20 /* - * Called when device is destroyed. - */ - void (*handle_destroy)(USBDevice *dev); - - /* * Attach the device */ void (*handle_attach)(USBDevice *dev); --=20 1.8.3.1 From nobody Sun May 5 11:28:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487864528997913.2850607685515; Thu, 23 Feb 2017 07:42:08 -0800 (PST) Received: from localhost ([::1]:59401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgvWx-0001bF-0G for importer@patchew.org; Thu, 23 Feb 2017 10:42:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgvVJ-0000iN-12 for qemu-devel@nongnu.org; Thu, 23 Feb 2017 10:40:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgvVI-0006pM-0L for qemu-devel@nongnu.org; Thu, 23 Feb 2017 10:40:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57252) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgvVH-0006oz-QT for qemu-devel@nongnu.org; Thu, 23 Feb 2017 10:40:23 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 25B01C054939; Thu, 23 Feb 2017 15:40:21 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1NFeIZd016437; Thu, 23 Feb 2017 10:40:20 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id CA7CE80B72; Thu, 23 Feb 2017 16:40:16 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 23 Feb 2017 16:40:13 +0100 Message-Id: <1487864414-25485-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1487864414-25485-1-git-send-email-kraxel@redhat.com> References: <1487864414-25485-1-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 23 Feb 2017 15:40:23 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/3] usb: ohci: fix error return code in servicing td X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang , Li Qiang , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Li Qiang It should return 1 if an error occurs when reading td. This will avoid an infinite loop issue in ohci_service_ed_list. Signed-off-by: Li Qiang Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 1487760990-115925-1-git-send-email-liqiang6-s@360.cn Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-ohci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 21c93e0..fe8406a 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -1001,7 +1001,7 @@ static int ohci_service_td(OHCIState *ohci, struct oh= ci_ed *ed) if (ohci_read_td(ohci, addr, &td)) { trace_usb_ohci_td_read_error(addr); ohci_die(ohci); - return 0; + return 1; } =20 dir =3D OHCI_BM(ed->flags, ED_D); --=20 1.8.3.1 From nobody Sun May 5 11:28:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487864653136917.3102078199026; Thu, 23 Feb 2017 07:44:13 -0800 (PST) Received: from localhost ([::1]:59409 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgvYw-0004KP-S7 for importer@patchew.org; Thu, 23 Feb 2017 10:44:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52648) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgvVI-0000hj-3z for qemu-devel@nongnu.org; Thu, 23 Feb 2017 10:40:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgvVG-0006oV-93 for qemu-devel@nongnu.org; Thu, 23 Feb 2017 10:40:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48692) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgvVG-0006ny-09 for qemu-devel@nongnu.org; Thu, 23 Feb 2017 10:40:22 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 223793D967 for ; Thu, 23 Feb 2017 15:40:22 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1NFeLcN027463; Thu, 23 Feb 2017 10:40:21 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id DBC4780B78; Thu, 23 Feb 2017 16:40:16 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 23 Feb 2017 16:40:14 +0100 Message-Id: <1487864414-25485-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1487864414-25485-1-git-send-email-kraxel@redhat.com> References: <1487864414-25485-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 23 Feb 2017 15:40:22 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/3] xhci: properties cleanup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Split xhci properties into common and nec specific. Move the backward compat flags to nec, so the new qemu-xhci devices doesn't carry on the compatibiity stuff. Move the msi/msix switches too and just enable msix for qemu-xhci. Also move the intrs and slots properties. Wasn't a great idea to make them configurable in the first place, nobody needs this. Signed-off-by: Gerd Hoffmann Message-id: 1487663432-10410-1-git-send-email-kraxel@redhat.com --- hw/usb/hcd-xhci.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 28dd2f2..f0af852 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -635,6 +635,11 @@ static bool xhci_get_flag(XHCIState *xhci, enum xhci_f= lags bit) return xhci->flags & (1 << bit); } =20 +static void xhci_set_flag(XHCIState *xhci, enum xhci_flags bit) +{ + xhci->flags |=3D (1 << bit); +} + static uint64_t xhci_mfindex_get(XHCIState *xhci) { int64_t now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); @@ -3839,17 +3844,21 @@ static const VMStateDescription vmstate_xhci =3D { } }; =20 -static Property xhci_properties[] =3D { +static Property nec_xhci_properties[] =3D { DEFINE_PROP_ON_OFF_AUTO("msi", XHCIState, msi, ON_OFF_AUTO_AUTO), DEFINE_PROP_ON_OFF_AUTO("msix", XHCIState, msix, ON_OFF_AUTO_AUTO), DEFINE_PROP_BIT("superspeed-ports-first", XHCIState, flags, XHCI_FLAG_SS_FIRST, true), DEFINE_PROP_BIT("force-pcie-endcap", XHCIState, flags, XHCI_FLAG_FORCE_PCIE_ENDCAP, false), - DEFINE_PROP_BIT("streams", XHCIState, flags, - XHCI_FLAG_ENABLE_STREAMS, true), DEFINE_PROP_UINT32("intrs", XHCIState, numintrs, MAXINTRS), DEFINE_PROP_UINT32("slots", XHCIState, numslots, MAXSLOTS), + DEFINE_PROP_END_OF_LIST(), +}; + +static Property xhci_properties[] =3D { + DEFINE_PROP_BIT("streams", XHCIState, flags, + XHCI_FLAG_ENABLE_STREAMS, true), DEFINE_PROP_UINT32("p2", XHCIState, numports_2, 4), DEFINE_PROP_UINT32("p3", XHCIState, numports_3, 4), DEFINE_PROP_END_OF_LIST(), @@ -3881,7 +3890,9 @@ static const TypeInfo xhci_info =3D { static void nec_xhci_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); + DeviceClass *dc =3D DEVICE_CLASS(klass); =20 + dc->props =3D nec_xhci_properties; k->vendor_id =3D PCI_VENDOR_ID_NEC; k->device_id =3D PCI_DEVICE_ID_NEC_UPD720200; k->revision =3D 0x03; @@ -3902,10 +3913,22 @@ static void qemu_xhci_class_init(ObjectClass *klass= , void *data) k->revision =3D 0x01; } =20 +static void qemu_xhci_instance_init(Object *obj) +{ + XHCIState *xhci =3D XHCI(obj); + + xhci->msi =3D ON_OFF_AUTO_OFF; + xhci->msix =3D ON_OFF_AUTO_AUTO; + xhci->numintrs =3D MAXINTRS; + xhci->numslots =3D MAXSLOTS; + xhci_set_flag(xhci, XHCI_FLAG_SS_FIRST); +} + static const TypeInfo qemu_xhci_info =3D { .name =3D TYPE_QEMU_XHCI, .parent =3D TYPE_XHCI, .class_init =3D qemu_xhci_class_init, + .instance_init =3D qemu_xhci_instance_init, }; =20 static void xhci_register_types(void) --=20 1.8.3.1