Commit 615fe4de authored by Miroslav Rezanina's avatar Miroslav Rezanina Committed by Gerd Hoffmann
Browse files

Remove dev-bluetooth.c dependency from vl.c



Use usb_legacy_register handling to create bt-dongle device and remove code
dependency from vl.c so CONFIG_USB_BLUETOOTH can be disabled.
Signed-off-by: default avatarMiroslav Rezanina <mrezanin@redhat.com>
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 644e1a8a
...@@ -18,9 +18,6 @@ common-obj-$(CONFIG_USB_STORAGE_UAS) += dev-uas.o ...@@ -18,9 +18,6 @@ common-obj-$(CONFIG_USB_STORAGE_UAS) += dev-uas.o
common-obj-$(CONFIG_USB_AUDIO) += dev-audio.o common-obj-$(CONFIG_USB_AUDIO) += dev-audio.o
common-obj-$(CONFIG_USB_SERIAL) += dev-serial.o common-obj-$(CONFIG_USB_SERIAL) += dev-serial.o
common-obj-$(CONFIG_USB_NETWORK) += dev-network.o common-obj-$(CONFIG_USB_NETWORK) += dev-network.o
# FIXME: make configurable too
CONFIG_USB_BLUETOOTH := y
common-obj-$(CONFIG_USB_BLUETOOTH) += dev-bluetooth.o common-obj-$(CONFIG_USB_BLUETOOTH) += dev-bluetooth.o
ifeq ($(CONFIG_USB_SMARTCARD),y) ifeq ($(CONFIG_USB_SMARTCARD),y)
......
...@@ -511,10 +511,17 @@ static int usb_bt_initfn(USBDevice *dev) ...@@ -511,10 +511,17 @@ static int usb_bt_initfn(USBDevice *dev)
return 0; return 0;
} }
USBDevice *usb_bt_init(USBBus *bus, HCIInfo *hci) static USBDevice *usb_bt_init(USBBus *bus, const char *cmdline)
{ {
USBDevice *dev; USBDevice *dev;
struct USBBtState *s; struct USBBtState *s;
HCIInfo *hci;
if (*cmdline) {
hci = hci_init(cmdline);
} else {
hci = bt_new_hci(qemu_find_bt_vlan(0));
}
if (!hci) if (!hci)
return NULL; return NULL;
...@@ -566,6 +573,7 @@ static const TypeInfo bt_info = { ...@@ -566,6 +573,7 @@ static const TypeInfo bt_info = {
static void usb_bt_register_types(void) static void usb_bt_register_types(void)
{ {
type_register_static(&bt_info); type_register_static(&bt_info);
usb_legacy_register("usb-bt-dongle", "bt", usb_bt_init);
} }
type_init(usb_bt_register_types) type_init(usb_bt_register_types)
...@@ -442,9 +442,6 @@ int set_usb_string(uint8_t *buf, const char *str); ...@@ -442,9 +442,6 @@ int set_usb_string(uint8_t *buf, const char *str);
USBDevice *usb_host_device_open(USBBus *bus, const char *devname); USBDevice *usb_host_device_open(USBBus *bus, const char *devname);
void usb_host_info(Monitor *mon, const QDict *qdict); void usb_host_info(Monitor *mon, const QDict *qdict);
/* usb-bt.c */
USBDevice *usb_bt_init(USBBus *bus, HCIInfo *hci);
/* usb ports of the VM */ /* usb ports of the VM */
#define VM_USB_HUB_SIZE 8 #define VM_USB_HUB_SIZE 8
......
...@@ -1457,8 +1457,10 @@ static void configure_msg(QemuOpts *opts) ...@@ -1457,8 +1457,10 @@ static void configure_msg(QemuOpts *opts)
static int usb_device_add(const char *devname) static int usb_device_add(const char *devname)
{ {
const char *p;
USBDevice *dev = NULL; USBDevice *dev = NULL;
#ifndef CONFIG_LINUX
const char *p;
#endif
if (!usb_enabled(false)) { if (!usb_enabled(false)) {
return -1; return -1;
...@@ -1474,15 +1476,8 @@ static int usb_device_add(const char *devname) ...@@ -1474,15 +1476,8 @@ static int usb_device_add(const char *devname)
/* only the linux version is qdev-ified, usb-bsd still needs this */ /* only the linux version is qdev-ified, usb-bsd still needs this */
if (strstart(devname, "host:", &p)) { if (strstart(devname, "host:", &p)) {
dev = usb_host_device_open(usb_bus_find(-1), p); dev = usb_host_device_open(usb_bus_find(-1), p);
} else
#endif
if (!strcmp(devname, "bt") || strstart(devname, "bt:", &p)) {
dev = usb_bt_init(usb_bus_find(-1),
devname[2] ? hci_init(p)
: bt_new_hci(qemu_find_bt_vlan(0)));
} else {
return -1;
} }
#endif
if (!dev) if (!dev)
return -1; return -1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment