hw/usb: move stubs out of stubs/
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 8 Apr 2024 15:53:22 +0000 (17:53 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 18 Apr 2024 09:17:27 +0000 (11:17 +0200)
Since the USB stubs are needed exactly when the Kconfig symbols are not
enabled, they can be placed in hw/usb/ and conditionalized on CONFIG_USB.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20240408155330.522792-11-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/usb/bus-stub.c [new file with mode: 0644]
hw/usb/meson.build
stubs/meson.build
stubs/usb-dev-stub.c [deleted file]

diff --git a/hw/usb/bus-stub.c b/hw/usb/bus-stub.c
new file mode 100644 (file)
index 0000000..fcabe84
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * QEMU USB device emulation stubs
+ *
+ * Copyright (C) 2021 Philippe Mathieu-Daudé <f4bug@amsat.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/error-report.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-machine.h"
+#include "sysemu/sysemu.h"
+#include "monitor/monitor.h"
+#include "hw/usb.h"
+
+USBDevice *usbdevice_create(const char *driver)
+{
+    error_report("Support for USB devices not built-in");
+
+    return NULL;
+}
+
+HumanReadableText *qmp_x_query_usb(Error **errp)
+{
+    error_setg(errp, "Support for USB devices not built-in");
+    return NULL;
+}
index aac3bb35f276308f942e88ca8c9808976824308a..23f7f7acb50b661969ebda6a20feeacdadd7c6e3 100644 (file)
@@ -9,7 +9,7 @@ system_ss.add(when: 'CONFIG_USB', if_true: files(
   'desc-msos.c',
   'libhw.c',
   'pcap.c',
-))
+), if_false: files('bus-stub.c'))
 
 # usb host adapters
 system_ss.add(when: 'CONFIG_USB_UHCI', if_true: files('hcd-uhci.c'))
index aa7120f711001d9dcdff46cae436d1d4b8cda6ce..45616afbfaa5f9517723a35aaecf6379dd8c26f4 100644 (file)
@@ -56,7 +56,6 @@ endif
 if have_system
   stub_ss.add(files('fw_cfg.c'))
   stub_ss.add(files('semihost.c'))
-  stub_ss.add(files('usb-dev-stub.c'))
   stub_ss.add(files('xen-hw-stub.c'))
   stub_ss.add(files('virtio-md-pci.c'))
 else
diff --git a/stubs/usb-dev-stub.c b/stubs/usb-dev-stub.c
deleted file mode 100644 (file)
index fcabe84..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * QEMU USB device emulation stubs
- *
- * Copyright (C) 2021 Philippe Mathieu-Daudé <f4bug@amsat.org>
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-#include "qemu/osdep.h"
-#include "qemu/error-report.h"
-#include "qapi/error.h"
-#include "qapi/qapi-commands-machine.h"
-#include "sysemu/sysemu.h"
-#include "monitor/monitor.h"
-#include "hw/usb.h"
-
-USBDevice *usbdevice_create(const char *driver)
-{
-    error_report("Support for USB devices not built-in");
-
-    return NULL;
-}
-
-HumanReadableText *qmp_x_query_usb(Error **errp)
-{
-    error_setg(errp, "Support for USB devices not built-in");
-    return NULL;
-}