@@ -27,7 +27,9 @@
#include "hw/usb/xhci.h"
#include "sysemu/dma.h"
-OBJECT_DECLARE_SIMPLE_TYPE(XHCIState, XHCI)
+#define TYPE_XHCI_COMMON "base-xhci" /* Common to PCI and Sysbus */
+
+OBJECT_DECLARE_SIMPLE_TYPE(XHCIState, XHCI_COMMON)
/* Very pessimistic, let's hope it's enough for all cases */
#define EV_QUEUE (((3 * 24) + 16) * XHCI_MAXSLOTS)
@@ -1,7 +1,6 @@
#ifndef HW_USB_XHCI_H
#define HW_USB_XHCI_H
-#define TYPE_XHCI "base-xhci"
#define TYPE_NEC_XHCI "nec-usb-xhci"
#define TYPE_QEMU_XHCI "qemu-xhci"
#define TYPE_XHCI_SYSBUS "sysbus-xhci"
@@ -193,7 +193,7 @@ static void xhci_instance_init(Object *obj)
* line, therefore, no need to wait to realize like other devices
*/
PCI_DEVICE(obj)->cap_present |= QEMU_PCI_CAP_EXPRESS;
- object_initialize_child(obj, "xhci-core", &s->xhci, TYPE_XHCI);
+ object_initialize_child(obj, "xhci-core", &s->xhci, TYPE_XHCI_COMMON);
qdev_alias_all_properties(DEVICE(&s->xhci), obj);
}
@@ -58,7 +58,7 @@ static void xhci_sysbus_instance_init(Object *obj)
{
XHCISysbusState *s = XHCI_SYSBUS(obj);
- object_initialize_child(obj, "xhci-core", &s->xhci, TYPE_XHCI);
+ object_initialize_child(obj, "xhci-core", &s->xhci, TYPE_XHCI_COMMON);
qdev_alias_all_properties(DEVICE(&s->xhci), obj);
object_property_add_link(obj, "dma", TYPE_MEMORY_REGION,
@@ -2637,7 +2637,7 @@ static void xhci_port_reset(XHCIPort *port, bool warm_reset)
static void xhci_reset(DeviceState *dev)
{
- XHCIState *xhci = XHCI(dev);
+ XHCIState *xhci = XHCI_COMMON(dev);
int i;
trace_usb_xhci_reset();
@@ -2891,7 +2891,7 @@ static uint64_t xhci_oper_read(void *ptr, hwaddr reg, unsigned size)
static void xhci_oper_write(void *ptr, hwaddr reg,
uint64_t val, unsigned size)
{
- XHCIState *xhci = XHCI(ptr);
+ XHCIState *xhci = XHCI_COMMON(ptr);
trace_usb_xhci_oper_write(reg, val);
@@ -3327,7 +3327,7 @@ static void usb_xhci_realize(DeviceState *dev, Error **errp)
{
int i;
- XHCIState *xhci = XHCI(dev);
+ XHCIState *xhci = XHCI_COMMON(dev);
if (xhci->numintrs > XHCI_MAXINTRS) {
xhci->numintrs = XHCI_MAXINTRS;
@@ -3381,7 +3381,7 @@ static void usb_xhci_realize(DeviceState *dev, Error **errp)
static void usb_xhci_unrealize(DeviceState *dev)
{
int i;
- XHCIState *xhci = XHCI(dev);
+ XHCIState *xhci = XHCI_COMMON(dev);
trace_usb_xhci_exit();
@@ -3591,7 +3591,7 @@ static void xhci_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo xhci_info = {
- .name = TYPE_XHCI,
+ .name = TYPE_XHCI_COMMON,
.parent = TYPE_DEVICE,
.instance_size = sizeof(XHCIState),
.class_init = xhci_class_init,
Follow the code base style by using the _COMMON suffix to abstract QOM types. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- hw/usb/hcd-xhci.h | 4 +++- include/hw/usb/xhci.h | 1 - hw/usb/hcd-xhci-pci.c | 2 +- hw/usb/hcd-xhci-sysbus.c | 2 +- hw/usb/hcd-xhci.c | 10 +++++----- 5 files changed, 10 insertions(+), 9 deletions(-)