From patchwork Tue Sep 3 09:23:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miroslav Rezanina X-Patchwork-Id: 272183 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 804872C009C for ; Tue, 3 Sep 2013 19:25:25 +1000 (EST) Received: from localhost ([::1]:44331 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VGmrR-0000Ji-Ue for incoming@patchwork.ozlabs.org; Tue, 03 Sep 2013 05:25:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VGmpW-0006KG-R5 for qemu-devel@nongnu.org; Tue, 03 Sep 2013 05:23:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VGmpQ-0008Gw-RJ for qemu-devel@nongnu.org; Tue, 03 Sep 2013 05:23:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8007) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VGmpQ-0008Gs-J7 for qemu-devel@nongnu.org; Tue, 03 Sep 2013 05:23:16 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r839NFcJ024958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 3 Sep 2013 05:23:16 -0400 Received: from lws-ntb.usersys.redhat.com.com (ovpn-116-38.ams2.redhat.com [10.36.116.38]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r839NBSB001667 for ; Tue, 3 Sep 2013 05:23:14 -0400 From: mrezanin@redhat.com To: qemu-devel@nongnu.org Date: Tue, 3 Sep 2013 11:23:09 +0200 Message-Id: <5872bfafe451d2a56b8d50e2f8cd3245973fbdc5.1378199429.git.mrezanin@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCHv3 2/2] Remove dev-bluetooth.c dependency from vl.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Miroslav Rezanina 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: Miroslav Rezanina --- hw/usb/Makefile.objs | 3 --- hw/usb/dev-bluetooth.c | 10 +++++++++- include/hw/usb.h | 3 --- vl.c | 13 ++++--------- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs index f9695e7..a3eac3e 100644 --- a/hw/usb/Makefile.objs +++ b/hw/usb/Makefile.objs @@ -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_SERIAL) += dev-serial.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 ifeq ($(CONFIG_USB_SMARTCARD),y) diff --git a/hw/usb/dev-bluetooth.c b/hw/usb/dev-bluetooth.c index f2fc2a8..7f292b1 100644 --- a/hw/usb/dev-bluetooth.c +++ b/hw/usb/dev-bluetooth.c @@ -511,10 +511,17 @@ static int usb_bt_initfn(USBDevice *dev) return 0; } -USBDevice *usb_bt_init(USBBus *bus, HCIInfo *hci) +static USBDevice *usb_bt_init(USBBus *bus, const char *cmdline) { USBDevice *dev; struct USBBtState *s; + HCIInfo *hci; + + if (*cmdline) { + hci = hci_init(cmdline); + } else { + hci = bt_new_hci(qemu_find_bt_vlan(0)); + } if (!hci) return NULL; @@ -566,6 +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); } type_init(usb_bt_register_types) diff --git a/include/hw/usb.h b/include/hw/usb.h index 901b0da..695d853 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -442,9 +442,6 @@ int set_usb_string(uint8_t *buf, const char *str); USBDevice *usb_host_device_open(USBBus *bus, const char *devname); 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 */ #define VM_USB_HUB_SIZE 8 diff --git a/vl.c b/vl.c index 2721a62..794e6b3 100644 --- a/vl.c +++ b/vl.c @@ -1457,8 +1457,10 @@ static void configure_msg(QemuOpts *opts) static int usb_device_add(const char *devname) { - const char *p; USBDevice *dev = NULL; +#ifndef CONFIG_LINUX + const char *p; +#endif if (!usb_enabled(false)) { return -1; @@ -1474,15 +1476,8 @@ static int usb_device_add(const char *devname) /* only the linux version is qdev-ified, usb-bsd still needs this */ if (strstart(devname, "host:", &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) return -1;