summaryrefslogtreecommitdiff
path: root/hw/usb
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2015-05-06 20:55:25 +0800
committerGerd Hoffmann <kraxel@redhat.com>2015-05-08 13:01:06 +0200
commita293e82bbef666f66be733993e276998319568e1 (patch)
treeeb280f6d9f30077f914d6f5b0dc7fd1ca525ab68 /hw/usb
parent0389a0b10967b639ac7444453274b910a4b6f2ed (diff)
downloadqemu-a293e82bbef666f66be733993e276998319568e1.zip
usb: usb-bt QOMify
Signed-off-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r--hw/usb/dev-bluetooth.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/hw/usb/dev-bluetooth.c b/hw/usb/dev-bluetooth.c
index 9bf673057a..b19ec76b00 100644
--- a/hw/usb/dev-bluetooth.c
+++ b/hw/usb/dev-bluetooth.c
@@ -49,6 +49,9 @@ struct USBBtState {
} outcmd, outacl, outsco;
};
+#define TYPE_USB_BT "usb-bt-dongle"
+#define USB_BT(obj) OBJECT_CHECK(struct USBBtState, (obj), TYPE_USB_BT)
+
#define USB_EVT_EP 1
#define USB_ACL_EP 2
#define USB_SCO_EP 3
@@ -503,7 +506,7 @@ static void usb_bt_handle_destroy(USBDevice *dev)
static void usb_bt_realize(USBDevice *dev, Error **errp)
{
- struct USBBtState *s = DO_UPCAST(struct USBBtState, dev, dev);
+ struct USBBtState *s = USB_BT(dev);
usb_desc_create_serial(dev);
usb_desc_init(dev);
@@ -523,7 +526,7 @@ static USBDevice *usb_bt_init(USBBus *bus, const char *cmdline)
USBDevice *dev;
struct USBBtState *s;
HCIInfo *hci;
- const char *name = "usb-bt-dongle";
+ const char *name = TYPE_USB_BT;
if (*cmdline) {
hci = hci_init(cmdline);
@@ -534,7 +537,7 @@ static USBDevice *usb_bt_init(USBBus *bus, const char *cmdline)
return NULL;
dev = usb_create(bus, name);
- s = DO_UPCAST(struct USBBtState, dev, dev);
+ s = USB_BT(dev);
s->hci = hci;
return dev;
}
@@ -561,7 +564,7 @@ static void usb_bt_class_initfn(ObjectClass *klass, void *data)
}
static const TypeInfo bt_info = {
- .name = "usb-bt-dongle",
+ .name = TYPE_USB_BT,
.parent = TYPE_USB_DEVICE,
.instance_size = sizeof(struct USBBtState),
.class_init = usb_bt_class_initfn,
@@ -570,7 +573,7 @@ static const TypeInfo bt_info = {
static void usb_bt_register_types(void)
{
type_register_static(&bt_info);
- usb_legacy_register("usb-bt-dongle", "bt", usb_bt_init);
+ usb_legacy_register(TYPE_USB_BT, "bt", usb_bt_init);
}
type_init(usb_bt_register_types)