Received: by 10.213.65.68 with SMTP id h4csp526821imn; Fri, 16 Mar 2018 10:25:52 -0700 (PDT) X-Google-Smtp-Source: AG47ELvmfCFDxdCrufWjEXcIk+RlMjIs7kFy//0G94D5S5TlJeZBDCHRx/Pe2WY9wH5gHxW7fGQo X-Received: by 10.99.191.65 with SMTP id i1mr522401pgo.269.1521221152417; Fri, 16 Mar 2018 10:25:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521221152; cv=none; d=google.com; s=arc-20160816; b=uEVDCR0TLPrYFfTC4Osq8fDPSJV5ugUWkNyEhU+sFe64q6rqZvGpfqwUUjWoHYe788 EKNVzuLM7zdF4/3KAsN9AASRMBtB2lgo6CSF6U+3fUU/itoJPSZD8hHDykNczOwYjZez u5IqHI32HqllrDKxSinC0VvI2UbeOo1E3fUsDrFNkC+NBiWZci0qiCZ8S1pTwd7rMorp ux9HRisWglGHhfyIrt7xH4Gn81rmDrz2fSCCdW71xKZnMJacds4Zl/0OTvK1FRgsL7SI OqP2cfet/HNUsj9oS6kIEWA6HGDopD70pEEVbMyJ8gC6t+XhVrJtmZAmorE6Kx7rBsry Pajg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=aU24pC/W/uzIRyHd/p46CCSutgHxblNr/aKhr44v7Oc=; b=F0shy5ds6wvS7y3Qteu/uY9nKmZy5IdjPk2JaZKHGv8UuYy/adqq8mMceEPl6f/k+g 2VFMXTcEWtVua8nUvJsyEnOm42vM9KNCxI0Xa8KScaX3X3GhNBww6M3Wjka818pIMzo3 jC4YM0gCO3cdDuQ35IwEADS+INLbxjjOm5OR2QMPEtjOBGvJMU//A/tNYPrIW9DTmmOF qlkUsx38gE3/95Bteec44KikEbGYo8Te02c9MOqG/90+4Iegfu+1rkdzFFi3oPjMTobP 1uon2FN+GY2n8WoDzmyTE4nvJzfsqTiemSmacZXGCvbBUEtAtGR26q7eM02N3iCNt/Ag Y72A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7-v6si1613091plr.398.2018.03.16.10.25.38; Fri, 16 Mar 2018 10:25:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933007AbeCPP3L (ORCPT + 99 others); Fri, 16 Mar 2018 11:29:11 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36050 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932991AbeCPP3J (ORCPT ); Fri, 16 Mar 2018 11:29:09 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A6F72FB0; Fri, 16 Mar 2018 15:29:08 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Danilo Krummrich Subject: [PATCH 4.4 58/63] usb: quirks: add control message delay for 1b1c:1b20 Date: Fri, 16 Mar 2018 16:23:30 +0100 Message-Id: <20180316152306.387571790@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152259.964532775@linuxfoundation.org> References: <20180316152259.964532775@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Danilo Krummrich commit cb88a0588717ba6c756cb5972d75766b273a6817 upstream. Corsair Strafe RGB keyboard does not respond to usb control messages sometimes and hence generates timeouts. Commit de3af5bf259d ("usb: quirks: add delay init quirk for Corsair Strafe RGB keyboard") tried to fix those timeouts by adding USB_QUIRK_DELAY_INIT. Unfortunately, even with this quirk timeouts of usb_control_msg() can still be seen, but with a lower frequency (approx. 1 out of 15): [ 29.103520] usb 1-8: string descriptor 0 read error: -110 [ 34.363097] usb 1-8: can't set config #1, error -110 Adding further delays to different locations where usb control messages are issued just moves the timeouts to other locations, e.g.: [ 35.400533] usbhid 1-8:1.0: can't add hid device: -110 [ 35.401014] usbhid: probe of 1-8:1.0 failed with error -110 The only way to reliably avoid those issues is having a pause after each usb control message. In approx. 200 boot cycles no more timeouts were seen. Addionaly, keep USB_QUIRK_DELAY_INIT as it turned out to be necessary to have the delay in hub_port_connect() after hub_port_init(). The overall boot time seems not to be influenced by these additional delays, even on fast machines and lightweight distributions. Fixes: de3af5bf259d ("usb: quirks: add delay init quirk for Corsair Strafe RGB keyboard") Cc: stable@vger.kernel.org Signed-off-by: Danilo Krummrich Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/message.c | 4 ++++ drivers/usb/core/quirks.c | 3 ++- include/linux/usb/quirks.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -147,6 +147,10 @@ int usb_control_msg(struct usb_device *d ret = usb_internal_control_msg(dev, pipe, dr, data, size, timeout); + /* Linger a bit, prior to the next control message. */ + if (dev->quirks & USB_QUIRK_DELAY_CTRL_MSG) + msleep(200); + kfree(dr); return ret; --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -229,7 +229,8 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT }, /* Corsair Strafe RGB */ - { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT }, + { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT | + USB_QUIRK_DELAY_CTRL_MSG }, /* Corsair K70 LUX */ { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT }, --- a/include/linux/usb/quirks.h +++ b/include/linux/usb/quirks.h @@ -56,4 +56,7 @@ */ #define USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL BIT(11) +/* Device needs a pause after every control message. */ +#define USB_QUIRK_DELAY_CTRL_MSG BIT(13) + #endif /* __LINUX_USB_QUIRKS_H */