All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] hw/usb/host-libusb.c: fix build with kernel < 5.0
@ 2020-12-13 21:30 Fabrice Fontaine
  2020-12-13 21:48 ` no-reply
  2020-12-15  7:58 ` Gerd Hoffmann
  0 siblings, 2 replies; 3+ messages in thread
From: Fabrice Fontaine @ 2020-12-13 21:30 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 assumption 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>
---
Changes v1 -> v2:
 - Fix error about line being over 90 characters

 hw/usb/host-libusb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index b950501d10..07ccceb16d 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -941,7 +941,8 @@ 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] 3+ messages in thread

* Re: [PATCH v2] hw/usb/host-libusb.c: fix build with kernel < 5.0
  2020-12-13 21:30 [PATCH v2] hw/usb/host-libusb.c: fix build with kernel < 5.0 Fabrice Fontaine
@ 2020-12-13 21:48 ` no-reply
  2020-12-15  7:58 ` Gerd Hoffmann
  1 sibling, 0 replies; 3+ messages in thread
From: no-reply @ 2020-12-13 21:48 UTC (permalink / raw)
  To: fontaine.fabrice; +Cc: fontaine.fabrice, qemu-devel, kraxel

Patchew URL: https://patchew.org/QEMU/20201213213016.457350-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: 20201213213016.457350-1-fontaine.fabrice@gmail.com
Subject: [PATCH v2] 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/20201213213016.457350-1-fontaine.fabrice@gmail.com -> patchew/20201213213016.457350-1-fontaine.fabrice@gmail.com
Switched to a new branch 'test'
85a9ab4 hw/usb/host-libusb.c: fix build with kernel < 5.0

=== OUTPUT BEGIN ===
ERROR: code indent should never use tabs
#36: FILE: hw/usb/host-libusb.c:945:
+^Idefined(USBDEVFS_GET_SPEED)$

total: 1 errors, 0 warnings, 9 lines checked

Commit 85a9ab423580 (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/20201213213016.457350-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] 3+ messages in thread

* Re: [PATCH v2] hw/usb/host-libusb.c: fix build with kernel < 5.0
  2020-12-13 21:30 [PATCH v2] hw/usb/host-libusb.c: fix build with kernel < 5.0 Fabrice Fontaine
  2020-12-13 21:48 ` no-reply
@ 2020-12-15  7:58 ` Gerd Hoffmann
  1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2020-12-15  7:58 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: qemu-devel

On Sun, Dec 13, 2020 at 10:30:16PM +0100, Fabrice Fontaine wrote:
> 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 assumption 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>

Added to usb queue.

thanks,
  Gerd



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

end of thread, other threads:[~2020-12-15  8:00 UTC | newest]

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

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.