cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
218e99
From d23a5d0e1d9a437515d566e29706e12373de9e25 Mon Sep 17 00:00:00 2001
218e99
From: Miroslav Rezanina <mrezanin@redhat.com>
218e99
Date: Mon, 16 Sep 2013 14:38:25 +0200
218e99
Subject: [PATCH 17/29] Remove dev-bluetooth.c dependency from vl.c
218e99
218e99
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
218e99
Message-id: <1948c111aeb1ae630ad580f4805d57c35eccceef.1379325610.git.mrezanin@redhat.com>
218e99
Patchwork-id: 54395
218e99
O-Subject: [RHEL7 qemu-kvm PATCH 2/2] Remove dev-bluetooth.c dependency from vl.c
218e99
Bugzilla: 1001131
218e99
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
218e99
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
218e99
From: Miroslav Rezanina <mrezanin@redhat.com>
218e99
218e99
Use usb_legacy_register handling to create bt-dongle device and remove code
218e99
dependency from vl.c so CONFIG_USB_BLUETOOTH can be disabled.
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
218e99
(cherry picked from commit 615fe4de4b3c26619611078960d3103550bde7d0)
218e99
---
218e99
 hw/usb/Makefile.objs   |  3 ---
218e99
 hw/usb/dev-bluetooth.c | 10 +++++++++-
218e99
 include/hw/usb.h       |  3 ---
218e99
 vl.c                   | 13 ++++---------
218e99
 4 files changed, 13 insertions(+), 16 deletions(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 hw/usb/Makefile.objs   |    3 ---
218e99
 hw/usb/dev-bluetooth.c |   10 +++++++++-
218e99
 include/hw/usb.h       |    3 ---
218e99
 vl.c                   |   13 ++++---------
218e99
 4 files changed, 13 insertions(+), 16 deletions(-)
218e99
218e99
diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
218e99
index f9695e7..a3eac3e 100644
218e99
--- a/hw/usb/Makefile.objs
218e99
+++ b/hw/usb/Makefile.objs
218e99
@@ -18,9 +18,6 @@ common-obj-$(CONFIG_USB_STORAGE_UAS)  += dev-uas.o
218e99
 common-obj-$(CONFIG_USB_AUDIO)        += dev-audio.o
218e99
 common-obj-$(CONFIG_USB_SERIAL)       += dev-serial.o
218e99
 common-obj-$(CONFIG_USB_NETWORK)      += dev-network.o
218e99
-
218e99
-# FIXME: make configurable too
218e99
-CONFIG_USB_BLUETOOTH := y
218e99
 common-obj-$(CONFIG_USB_BLUETOOTH)    += dev-bluetooth.o
218e99
 
218e99
 ifeq ($(CONFIG_USB_SMARTCARD),y)
218e99
diff --git a/hw/usb/dev-bluetooth.c b/hw/usb/dev-bluetooth.c
218e99
index 68cc1d4..786e30e 100644
218e99
--- a/hw/usb/dev-bluetooth.c
218e99
+++ b/hw/usb/dev-bluetooth.c
218e99
@@ -511,10 +511,17 @@ static int usb_bt_initfn(USBDevice *dev)
218e99
     return 0;
218e99
 }
218e99
 
218e99
-USBDevice *usb_bt_init(USBBus *bus, HCIInfo *hci)
218e99
+static USBDevice *usb_bt_init(USBBus *bus, const char *cmdline)
218e99
 {
218e99
     USBDevice *dev;
218e99
     struct USBBtState *s;
218e99
+    HCIInfo *hci;
218e99
+
218e99
+    if (*cmdline) {
218e99
+        hci = hci_init(cmdline);
218e99
+    } else {
218e99
+        hci = bt_new_hci(qemu_find_bt_vlan(0));
218e99
+    }
218e99
 
218e99
     if (!hci)
218e99
         return NULL;
218e99
@@ -565,6 +572,7 @@ static const TypeInfo bt_info = {
218e99
 static void usb_bt_register_types(void)
218e99
 {
218e99
     type_register_static(&bt_info);
218e99
+    usb_legacy_register("usb-bt-dongle", "bt", usb_bt_init);
218e99
 }
218e99
 
218e99
 type_init(usb_bt_register_types)
218e99
diff --git a/include/hw/usb.h b/include/hw/usb.h
218e99
index 901b0da..695d853 100644
218e99
--- a/include/hw/usb.h
218e99
+++ b/include/hw/usb.h
218e99
@@ -442,9 +442,6 @@ int set_usb_string(uint8_t *buf, const char *str);
218e99
 USBDevice *usb_host_device_open(USBBus *bus, const char *devname);
218e99
 void usb_host_info(Monitor *mon, const QDict *qdict);
218e99
 
218e99
-/* usb-bt.c */
218e99
-USBDevice *usb_bt_init(USBBus *bus, HCIInfo *hci);
218e99
-
218e99
 /* usb ports of the VM */
218e99
 
218e99
 #define VM_USB_HUB_SIZE 8
218e99
diff --git a/vl.c b/vl.c
218e99
index d022f50..a40ab13 100644
218e99
--- a/vl.c
218e99
+++ b/vl.c
218e99
@@ -1427,8 +1427,10 @@ static void configure_msg(QemuOpts *opts)
218e99
 
218e99
 static int usb_device_add(const char *devname)
218e99
 {
218e99
-    const char *p;
218e99
     USBDevice *dev = NULL;
218e99
+#ifndef CONFIG_LINUX
218e99
+    const char *p;
218e99
+#endif
218e99
 
218e99
     if (!usb_enabled(false)) {
218e99
         return -1;
218e99
@@ -1444,15 +1446,8 @@ static int usb_device_add(const char *devname)
218e99
     /* only the linux version is qdev-ified, usb-bsd still needs this */
218e99
     if (strstart(devname, "host:", &p)) {
218e99
         dev = usb_host_device_open(usb_bus_find(-1), p);
218e99
-    } else
218e99
-#endif
218e99
-    if (!strcmp(devname, "bt") || strstart(devname, "bt:", &p)) {
218e99
-        dev = usb_bt_init(usb_bus_find(-1),
218e99
-                          devname[2] ? hci_init(p)
218e99
-                                     : bt_new_hci(qemu_find_bt_vlan(0)));
218e99
-    } else {
218e99
-        return -1;
218e99
     }
218e99
+#endif
218e99
     if (!dev)
218e99
         return -1;
218e99
 
218e99
-- 
218e99
1.7.1
218e99