All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/usb/host-libusb.c: fix build with kernel < 5.0
@ 2020-12-13 21:04 Fabrice Fontaine
  2020-12-13 21:12 ` no-reply
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2020-12-13 21:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Fabrice Fontaine

USBDEVFS_GET_SPEED is used since version 5.2.0 and
https://gitlab.com/qemu-project/qemu/-/commit/202d69a715a4b1824dcd7ec1683d027ed2bae6d3
resulting in the following build failure with kernel < 5.0:

../hw/usb/host-libusb.c: In function 'usb_host_open':
../hw/usb/host-libusb.c:953:32: error: 'USBDEVFS_GET_SPEED' undeclared (first use in this function); did you mean 'USBDEVFS_GETDRIVER'?
         int rc = ioctl(hostfd, USBDEVFS_GET_SPEED, NULL);
                                ^~~~~~~~~~~~~~~~~~
                                USBDEVFS_GETDRIVER

A tentative was made to fix this build failure with
https://gitlab.com/qemu-project/qemu/-/commit/4969e697c15ac536d5c0700381d5d026ef7f0588

However, the assumtion that distros with old kernels also have old
libusb is just wrong so also add a check for defined(USBDEVFS_GET_SPEED)

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 hw/usb/host-libusb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index b950501d10..0343300d3e 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -941,7 +941,7 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
     usb_host_ep_update(s);
 
     libusb_speed = libusb_get_device_speed(dev);
-#if LIBUSB_API_VERSION >= 0x01000107 && defined(CONFIG_LINUX)
+#if LIBUSB_API_VERSION >= 0x01000107 && defined(CONFIG_LINUX) && defined(USBDEVFS_GET_SPEED)
     if (hostfd && libusb_speed == 0) {
         /*
          * Workaround libusb bug: libusb_get_device_speed() does not
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hw/usb/host-libusb.c: fix build with kernel < 5.0
  2020-12-13 21:04 [PATCH] hw/usb/host-libusb.c: fix build with kernel < 5.0 Fabrice Fontaine
@ 2020-12-13 21:12 ` no-reply
  0 siblings, 0 replies; 2+ messages in thread
From: no-reply @ 2020-12-13 21:12 UTC (permalink / raw)
  To: fontaine.fabrice; +Cc: fontaine.fabrice, qemu-devel, kraxel

Patchew URL: https://patchew.org/QEMU/20201213210455.299668-1-fontaine.fabrice@gmail.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20201213210455.299668-1-fontaine.fabrice@gmail.com
Subject: [PATCH] hw/usb/host-libusb.c: fix build with kernel < 5.0

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20201213210455.299668-1-fontaine.fabrice@gmail.com -> patchew/20201213210455.299668-1-fontaine.fabrice@gmail.com
Switched to a new branch 'test'
f20085b hw/usb/host-libusb.c: fix build with kernel < 5.0

=== OUTPUT BEGIN ===
ERROR: line over 90 characters
#35: FILE: hw/usb/host-libusb.c:944:
+#if LIBUSB_API_VERSION >= 0x01000107 && defined(CONFIG_LINUX) && defined(USBDEVFS_GET_SPEED)

total: 1 errors, 0 warnings, 8 lines checked

Commit f20085b58f8d (hw/usb/host-libusb.c: fix build with kernel < 5.0) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20201213210455.299668-1-fontaine.fabrice@gmail.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-13 21:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-13 21:04 [PATCH] hw/usb/host-libusb.c: fix build with kernel < 5.0 Fabrice Fontaine
2020-12-13 21:12 ` no-reply

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.