Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp16586450ybl; Wed, 1 Jan 2020 08:40:27 -0800 (PST) X-Google-Smtp-Source: APXvYqwCnVlxW1gcVXtoVukgyLmK8LIfaXeJzfNRvNH4KxiBPDs5ozsuzxIkAeklx1kOHv224ldH X-Received: by 2002:a05:6830:3c2:: with SMTP id p2mr21465619otc.213.1577896827357; Wed, 01 Jan 2020 08:40:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577896827; cv=none; d=google.com; s=arc-20160816; b=C8hq12IMt4pb7vHSwrky5+gn2NqfIkBY1ywp7fx/cBsDM8KE+++5lJ/CDLVw37+n11 UfTX+lrJr7j2cP5GsXhsBsEtCvynPrBST9PZUaMqLnh5UypvslIcpdAiYJLpUT/dS16/ XsQuFy5jm3jS//eI2q7FiPzNww7DWVQyL3KnMB7CeWIBbPP0JSfzoBuC5czqFm0fBnTm EABDY+rFJ4aewjVF3RsunelmfQ82Aq4m9KT7wwEickpHOtq88hAtP3AMMj/DMaTd0SGZ QQpABLtMn8cAStGUQP3jZIPa29IIVBLNb1cxJF3VNx6sx0fdrc1cmezwWSCoEIisexvv vLqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature; bh=e9xmC6WZve72kHa7WhwPzTlTU4WTjL1WO/1gzCOJ5zo=; b=KBydmEF+T9bVciHl6M9jyMs9rwHar5gyzzbzj6QW9igCQeaYJgFff3wLopPi5a1o5o bMSqU2e84naeec8T7vERxmY0Ncc8XmN0vq47ufcXXz4HqZhdZ0f382tn8I3333yn6Z8T 8j7KCRtYUuPP/rHDEfa46v3ExZv4QdOzGolBdIt6ChJWK55GGeyqiplhNQ7bzikKNgZd gHB8Tv4/QtyN+W0rYQTOcC0WXALJonab7KLoVAoIjdS0/7dUaFhNiGJip5dztF5g+cxJ iTtHLfSXfUmIOmcwT0ECbzzC/SOwiYrKc+3RH4o71W/6ZcKBRXpCIqdMs1524JVarQM3 382A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=efIoY73Q; 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 j24si24019557otn.110.2020.01.01.08.40.14; Wed, 01 Jan 2020 08:40:27 -0800 (PST) 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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=efIoY73Q; 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 S1727215AbgAAQi1 (ORCPT + 99 others); Wed, 1 Jan 2020 11:38:27 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:38656 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727154AbgAAQi1 (ORCPT ); Wed, 1 Jan 2020 11:38:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:To: Subject:Sender:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=e9xmC6WZve72kHa7WhwPzTlTU4WTjL1WO/1gzCOJ5zo=; b=efIoY73QpMA4ZHweuOSr4KR7k F/QRCsWO5WCO5ZOU+XHd62ji24UBRSDQU9EzyLPl2V0gEHXDd++oKBqOfbtd52htq0TCqpohg+riD safH+ibGhGvx2esBP++fXKRmKkSSHwmcmgoekupvjRAv3JlGsC/hnRSbfsTVZej1qV7PW1n/WMD3h MbcrFzkBO1NYXZH9ApA/eGZQoDN7I9kHZnZ3j7kxxCWp9T+LIZJg0gkhmLEolhuwoGHtpyzLdTpMx IfWz2S23pTlupTNKuAkv4vaEK3bQbPaTgJ6A76oPL/M2zS58Ci0PDotf81ajSSd7BPYyh3CtolNVL sGSrb7nDw==; Received: from [2601:1c0:6280:3f0::34d9] by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1imh0s-0004pt-JU; Wed, 01 Jan 2020 16:38:26 +0000 Subject: Re: Fw: usbcore missing parentheses in USE_NEW_SCHEME To: atmgnd , "linux-kernel@vger.kernel.org" , USB list References: <7sP4K0IcPrf4Z5urpZjWaiquSFhnNSNGLGsuYj8jbRl8aGGboUyknXW1w7DSBIYNUY308G2QnfDOTmblnyPKyoWMeiYwtqS6mdTxKZqfBO8=@protonmail.com> From: Randy Dunlap Message-ID: Date: Wed, 1 Jan 2020 08:38:25 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [adding linux-usb mailing list] On 1/1/20 6:46 AM, atmgnd wrote: > I think there is missing parentheses in macro USE_NEW_SCHEME, it should be: > #define USE_NEW_SCHEME(i, scheme) ((i) / 2 == (int)(scheme)) > > causes a fail wiht "device descriptor read/64, error -110" using my usb drive on vmware using usb 3.0 hub. > from https://github.com/torvalds/linux/commit/25244227158e1502062041365a439a54cb8fe673#diff-28615d62e1250eadc353d804f49bc6d6 > > someone changed USE_NEW_SCHEME, but without parentheses for second parameter. as result. in fuction use_new_scheme when old_scheme_first is 1, use_new_scheme will return 1 always(actullay is should return 0). it also make https://github.com/torvalds/linux/commit/bd0e6c9614b95352eb31d0207df16dc156c527fa#diff-28615d62e1250eadc353d804f49bc6d6 fails. > > I cannot use git send-mail, there some issue with my network provider. patch below, : > > > From 85f01b89d050a988f4d9fc78232de47e793c6a7c Mon Sep 17 00:00:00 2001 > From: atmgnd > Date: Wed, 1 Jan 2020 21:27:13 +0800 > Subject: [PATCH] usb: hub: missing parentheses in USE_NEW_SCHEME > > accroding to bd0e6c9#diff-28615d62e1250eadc353d804f49bc6d6, will try old enumeration > scheme first for high speed devices. for example, when a high speed device pluged in, > line 2720 should expand to 0 at the first time. USE_NEW_SCHEME(0, 0 || 0 || 1) === 0. > but it wrongly expand to 1(alway expand to 1 for high speed device), and change > USE_NEW_SCHEME to USE_NEW_SCHEME((i) % 2 == (int)(scheme)) may be better ? > > Signed-off-by: atmgnd > --- > drivers/usb/core/hub.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c > index f229ad6952c0..7d17deca7021 100644 > --- a/drivers/usb/core/hub.c > +++ b/drivers/usb/core/hub.c > @@ -2692,7 +2692,7 @@ static unsigned hub_is_wusb(struct usb_hub *hub) > #define SET_ADDRESS_TRIES 2 > #define GET_DESCRIPTOR_TRIES 2 > #define SET_CONFIG_TRIES (2 * (use_both_schemes + 1)) > -#define USE_NEW_SCHEME(i, scheme) ((i) / 2 == (int)scheme) > +#define USE_NEW_SCHEME(i, scheme) ((i) / 2 == (int)(scheme)) > > #define HUB_ROOT_RESET_TIME 60 /* times are in msec */ > #define HUB_SHORT_RESET_TIME 10 > -- > 2.17.1 > -- ~Randy