summary refs log tree commit diff stats
path: root/hw/usb/xen-usb.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-05-09 19:00:38 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2024-05-10 15:45:15 +0200
commit88f5ed7017897bc3108463e75e3b4828032a3992 (patch)
tree1d155866026dc00400fe880de86e0d4bbe57fd69 /hw/usb/xen-usb.c
parent0973996fe47bfca8f0bf552728e36682d642c9cc (diff)
downloadfocaccia-qemu-88f5ed7017897bc3108463e75e3b4828032a3992.tar.gz
focaccia-qemu-88f5ed7017897bc3108463e75e3b4828032a3992.zip
xen: register legacy backends via xen_backend_init
It is okay to register legacy backends in the middle of xen_bus_init().
All that the registration does is record the existence of the backend
in xenstore.

This makes it possible to remove them from the build without introducing
undefined symbols in xen_be_init().  It also removes the need for the
backend_register callback, whose only purpose is to avoid registering
nonfunctional backends.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240509170044.190795-8-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/usb/xen-usb.c')
-rw-r--r--hw/usb/xen-usb.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c
index 09ec326aea..416623f956 100644
--- a/hw/usb/xen-usb.c
+++ b/hw/usb/xen-usb.c
@@ -1083,7 +1083,7 @@ static void usbback_event(struct XenLegacyDevice *xendev)
     qemu_bh_schedule(usbif->bh);
 }
 
-struct XenDevOps xen_usb_ops = {
+static struct XenDevOps xen_usb_ops = {
     .size            = sizeof(struct usbback_info),
     .flags           = DEVOPS_FLAG_NEED_GNTDEV,
     .init            = usbback_init,
@@ -1095,15 +1095,9 @@ struct XenDevOps xen_usb_ops = {
     .event           = usbback_event,
 };
 
-#else /* USBIF_SHORT_NOT_OK */
-
-static int usbback_not_supported(void)
+static void xen_usb_register_backend(void)
 {
-    return -EINVAL;
+    xen_be_register("qusb", &xen_usb_ops);
 }
-
-struct XenDevOps xen_usb_ops = {
-    .backend_register = usbback_not_supported,
-};
-
+xen_backend_init(xen_usb_register_backend);
 #endif