[Spice-devel] [PATCH usbredir 5/8] Enable compatibility with older Linux kernels.

Jeremy White jwhite at codeweavers.com
Wed Dec 9 14:16:05 PST 2015


Signed-off-by: Jeremy White <jwhite at codeweavers.com>
---
 kernel/hub.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/kernel/hub.c b/kernel/hub.c
index 66ba64b..1c5f24d 100644
--- a/kernel/hub.c
+++ b/kernel/hub.c
@@ -305,6 +305,18 @@ static struct hc_driver usbredir_hc_driver = {
 };
 
 
+/* Older kernels required a -1 to indicate no irq line;
+ * This is an attempt to make this code handle both;
+ * we key off the fact that hcd.irq is signed in the old code */
+static int no_irq(void)
+{
+	struct usb_hcd hcd;
+	hcd.irq = -1;
+	if (hcd.irq > 0)
+		return 0;
+	return -1;
+}
+
 static int usbredir_create_hcd(struct usbredir_hub *hub)
 {
 	int ret;
@@ -320,7 +332,7 @@ static int usbredir_create_hcd(struct usbredir_hub *hub)
 
 	*((struct usbredir_hub **) hub->hcd->hcd_priv) = hub;
 
-	ret = usb_add_hcd(hub->hcd, 0, 0);
+	ret = usb_add_hcd(hub->hcd, no_irq(), 0);
 	if (ret != 0) {
 		pr_err("usb_add_hcd failed %d\n", ret);
 		usb_put_hcd(hub->hcd);
-- 
2.1.4



More information about the Spice-devel mailing list