Skip to contentSkip to conversation

usb-host: cleanups

PATCH In review Gerd Hoffmann 3 participants 6 messages Sep 8, 2017

lore
Share & tools
lore
#0 lore raw

cover usb-host: cleanups

Gerd Hoffmann (2):
usb: drop HOST_USB
usb: only build usb-host with CONFIG_USB=y

 configure            | 7 -------
 hw/usb/Makefile.objs | 6 +++++-
 2 files changed, 5 insertions(+), 8 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/2 usb: drop HOST_USB

Nowdays we use libusb for usb-host, so we don't have different code for linux vs. bsd any more. So there is little reason to have the HOST_USB variable, we can just write things directly into the Makefile and avoid a pointless indirection.

---
 configure            | 7 -------
 hw/usb/Makefile.objs | 6 +++++-
 2 files changed, 5 insertions(+), 8 deletions(-)
configure +0 -7
index a541aadebc..ec93234f47 100755
@@ -5978,13 +5978,6 @@ if test "$live_block_migration" = "yes" ; then
   echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
 fi
 
-# USB host support
-if test "$libusb" = "yes"; then
-  echo "HOST_USB=libusb legacy" >> $config_host_mak
-else
-  echo "HOST_USB=stub" >> $config_host_mak
-fi
-
 # TPM passthrough support?
 if test "$tpm" = "yes"; then
   echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
hw/usb/Makefile.objs +5 -1
index 97f1c4561a..a43ebbc17f 100644
@@ -38,7 +38,11 @@ endif
 common-obj-$(CONFIG_USB_REDIR) += redirect.o quirks.o
 
 # usb pass-through
-common-obj-y += $(patsubst %,host-%.o,$(HOST_USB))
+ifeq ($(CONFIG_LIBUSB),y)
+common-obj-y += host-libusb.o host-legacy.o
+else
+common-obj-y += host-stub.o
+endif
 
 ifeq ($(CONFIG_USB_LIBUSB),y)
 common-obj-$(CONFIG_XEN) += xen-usb.o
Signature · 1 line
2.9.3
#3 lore raw

PATCH 2/2 usb: only build usb-host with CONFIG_USB=y

In reply to Gerd Hoffmann
---
 hw/usb/Makefile.objs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/Makefile.objs +1 -1
index a43ebbc17f..757e365562 100644
@@ -38,7 +38,7 @@ endif
 common-obj-$(CONFIG_USB_REDIR) += redirect.o quirks.o
 
 # usb pass-through
-ifeq ($(CONFIG_LIBUSB),y)
+ifeq ($(CONFIG_LIBUSB)$(CONFIG_USB),yy)
 common-obj-y += host-libusb.o host-legacy.o
 else
 common-obj-y += host-stub.o
Signature · 1 line
2.9.3
Reviewed-by on v1 1/2
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] usb: drop HOST_USB

In reply to Gerd Hoffmann
Quoted 36 lines · Gerd Hoffmann

Nowdays we use libusb for usb-host, so we don't have different code for linux vs. bsd any more. So there is little reason to have the HOST_USB variable, we can just write things directly into the Makefile and avoid a pointless indirection.

---
 configure            | 7 -------
 hw/usb/Makefile.objs | 6 +++++-
 2 files changed, 5 insertions(+), 8 deletions(-)
configure +0 -7
index a541aadebc..ec93234f47 100755
@@ -5978,13 +5978,6 @@ if test "$live_block_migration" = "yes" ; then
   echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
 fi
 
-# USB host support
-if test "$libusb" = "yes"; then
-  echo "HOST_USB=libusb legacy" >> $config_host_mak
-else
-  echo "HOST_USB=stub" >> $config_host_mak
-fi
-
 # TPM passthrough support?
 if test "$tpm" = "yes"; then
   echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
hw/usb/Makefile.objs +0 -0
index 97f1c4561a..a43ebbc17f 100644
@@ -38,7 +38,11 @@ endif
 common-obj-$(CONFIG_USB_REDIR) += redirect.o quirks.o
 

hw/usb/Makefile.objs endif · line 48

Quoted 10 lines
hw/usb/Makefile.objs +5 -1
 # usb pass-through
-common-obj-y += $(patsubst %,host-%.o,$(HOST_USB))
+ifeq ($(CONFIG_LIBUSB),y)
+common-obj-y += host-libusb.o host-legacy.o
+else
+common-obj-y += host-stub.o
+endif
 
 ifeq ($(CONFIG_USB_LIBUSB),y)
 common-obj-$(CONFIG_XEN) += xen-usb.o
Tested-by on v1 2/2
#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] usb: only build usb-host with CONFIG_USB=y

In reply to Gerd Hoffmann
Quoted 10 lines · Gerd Hoffmann
---
 hw/usb/Makefile.objs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/Makefile.objs +0 -0
index a43ebbc17f..757e365562 100644

hw/usb/Makefile.objs endif · line 44

Quoted 8 lines
hw/usb/Makefile.objs +1 -1
@@ -38,7 +38,7 @@ endif
 common-obj-$(CONFIG_USB_REDIR) += redirect.o quirks.o
 
 # usb pass-through
-ifeq ($(CONFIG_LIBUSB),y)
+ifeq ($(CONFIG_LIBUSB)$(CONFIG_USB),yy)
 common-obj-y += host-libusb.o host-legacy.o
 else
 common-obj-y += host-stub.o

Strange that you did not need the hack with "common-obj-$(CONFIG_ALL)" in this patch like I had to do in the patch that I sent today... but I've just checked it, and it seems to work this way. So: