diff mbox series

[PATCH-for-4.1?,7/7] hw/bt: Allow building with CONFIG_BLUETOOTH disabled

Message ID 20190712133928.21394-8-philmd@redhat.com
State New
Headers show
Series vl: Allow building with CONFIG_BLUETOOTH disabled | expand

Commit Message

Philippe Mathieu-Daudé July 12, 2019, 1:39 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 Makefile.objs       |  3 ++-
 bt-stubs.c          | 18 ++++++++++++++++++
 hw/bt/Makefile.objs |  4 ++--
 3 files changed, 22 insertions(+), 3 deletions(-)
 create mode 100644 bt-stubs.c

Comments

Thomas Huth July 15, 2019, 1:08 p.m. UTC | #1
On 12/07/2019 15.39, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  Makefile.objs       |  3 ++-
>  bt-stubs.c          | 18 ++++++++++++++++++
>  hw/bt/Makefile.objs |  4 ++--
>  3 files changed, 22 insertions(+), 3 deletions(-)
>  create mode 100644 bt-stubs.c
> 
> diff --git a/Makefile.objs b/Makefile.objs
> index c2845a0efc..98269e393a 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -65,8 +65,9 @@ common-obj-y += replay/
>  
>  common-obj-y += ui/
>  common-obj-m += ui/
> -common-obj-y += bt-host.o bt-vhci.o bt-opts.o
>  bt-host.o-cflags := $(BLUEZ_CFLAGS)
> +common-obj-$(CONFIG_BLUETOOTH) += bt-host.o bt-vhci.o bt-opts.o
> +common-obj-$(call lnot,$(CONFIG_BLUETOOTH)) += bt-stubs.o
>  
>  common-obj-y += dma-helpers.o
>  common-obj-y += vl.o
> diff --git a/bt-stubs.c b/bt-stubs.c
> new file mode 100644
> index 0000000000..d3f5158d3b
> --- /dev/null
> +++ b/bt-stubs.c
> @@ -0,0 +1,18 @@
> +/*
> + * Bluetooth stubs.
> + *
> + * Copyright (c) 2019 Red Hat, Inc.
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include "qemu/osdep.h"
> +#include "qemu/error-report.h"
> +#include "sysemu/bt.h"
> +
> +int bt_parse(const char *opt)
> +{
> +    error_report("Bluetooth support is disabled");
> +
> +    return 1;
> +}
> diff --git a/hw/bt/Makefile.objs b/hw/bt/Makefile.objs
> index 867a7d2e8a..46aec8e38e 100644
> --- a/hw/bt/Makefile.objs
> +++ b/hw/bt/Makefile.objs
> @@ -1,3 +1,3 @@
> -common-obj-y += core.o l2cap.o sdp.o hci.o hid.o
> -common-obj-y += hci-csr.o
> +common-obj-$(CONFIG_BLUETOOTH) += core.o l2cap.o sdp.o hci.o hid.o
> +common-obj-$(CONFIG_BLUETOOTH) += hci-csr.o

... ok, so the BLUETOOTH switch gets used here. But I wonder whether we
should have separate switches for the backends (i.e. the files here) and
the guest devices (i.e. the ones in hw/bt/) ?

 Thomas
diff mbox series

Patch

diff --git a/Makefile.objs b/Makefile.objs
index c2845a0efc..98269e393a 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -65,8 +65,9 @@  common-obj-y += replay/
 
 common-obj-y += ui/
 common-obj-m += ui/
-common-obj-y += bt-host.o bt-vhci.o bt-opts.o
 bt-host.o-cflags := $(BLUEZ_CFLAGS)
+common-obj-$(CONFIG_BLUETOOTH) += bt-host.o bt-vhci.o bt-opts.o
+common-obj-$(call lnot,$(CONFIG_BLUETOOTH)) += bt-stubs.o
 
 common-obj-y += dma-helpers.o
 common-obj-y += vl.o
diff --git a/bt-stubs.c b/bt-stubs.c
new file mode 100644
index 0000000000..d3f5158d3b
--- /dev/null
+++ b/bt-stubs.c
@@ -0,0 +1,18 @@ 
+/*
+ * Bluetooth stubs.
+ *
+ * Copyright (c) 2019 Red Hat, Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/error-report.h"
+#include "sysemu/bt.h"
+
+int bt_parse(const char *opt)
+{
+    error_report("Bluetooth support is disabled");
+
+    return 1;
+}
diff --git a/hw/bt/Makefile.objs b/hw/bt/Makefile.objs
index 867a7d2e8a..46aec8e38e 100644
--- a/hw/bt/Makefile.objs
+++ b/hw/bt/Makefile.objs
@@ -1,3 +1,3 @@ 
-common-obj-y += core.o l2cap.o sdp.o hci.o hid.o
-common-obj-y += hci-csr.o
+common-obj-$(CONFIG_BLUETOOTH) += core.o l2cap.o sdp.o hci.o hid.o
+common-obj-$(CONFIG_BLUETOOTH) += hci-csr.o