Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17542321ybl; Thu, 2 Jan 2020 07:23:42 -0800 (PST) X-Google-Smtp-Source: APXvYqwz3OArV0J4aa9hNaII40CnSgwWOTU1DervLMxZ+Zz/rV36voNfntcyafgmUJujeR4T8tR+ X-Received: by 2002:aca:b7c5:: with SMTP id h188mr2348325oif.100.1577978622733; Thu, 02 Jan 2020 07:23:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577978622; cv=none; d=google.com; s=arc-20160816; b=RaoTgdScDwVl+c3JAqImpAOwv0OUIIZfe+L6ic4IfSV2Aa/qdL2YNP0wDUMPB8Xpjo zkloWYMs54WOhCKcxICxHTn+BiJGlm4NmgCpYRnLZ3+vjqm78k5n7HP5Uc0kygNKrBGM z7rv4/Sae1QX5d4bls6j6Ulgdl/5mvf6orAbvvcDtJysmHiMLr5obTd56KuE+VIW/wPa SW6eWy93hWtcjOfWzBCdrWj0FPJ5YuoLuZHi/fwPC8SPHos2g1cwSP2isXtxGmjabEXh 4J5O23BIhG+Rg8NPUo6Ewfd4UgaZljlPb/h+5eunzcQhoSpmwW2/PZs1fqaD9E4PA9/p 8LoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=dV1eFwaiG4my3eouPCZ1Z6kKiWpfPmEoTLiR/I6aoig=; b=iKhOFZF6MuZWwX3Pb3B2h01N+j55BnfaF199lORSL8USUCY8ExW99KN5OIaYv0e964 0wOvLAUINYiaBPRykTj8wEoD2Ku/gE9yIFb2vm/RpLPreuYFeduZMIsbysyorXO+Rm8e zrkdy+Ifzvikzv4ZSvGr8iYYHt+n08KE+sfMp5ju0xpV5t3OzP//WKiMfPM9/hA+7udQ QvRqb5+NSNn2ibdxUGt7J40yhuby7Rn3ZlecKCvUY4wvIXcxHZ6u/HA43XpkjaHLhcgW OKrT6Vz0byE2jH7fd9kbY3zZcoDOEC2whilYcCth7zYMJU3YeO83yuc/sOKMhnVIqI+D LJ0Q== 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 l14si26255788oii.37.2020.01.02.07.23.30; Thu, 02 Jan 2020 07:23:42 -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; 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 S1728761AbgABPWu (ORCPT + 99 others); Thu, 2 Jan 2020 10:22:50 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:41548 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728645AbgABPWu (ORCPT ); Thu, 2 Jan 2020 10:22:50 -0500 Received: (qmail 1847 invoked by uid 2102); 2 Jan 2020 10:22:49 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 2 Jan 2020 10:22:49 -0500 Date: Thu, 2 Jan 2020 10:22:49 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: atmgnd , Randy Dunlap cc: "linux-kernel@vger.kernel.org" , USB list Subject: Re: Fw: usbcore missing parentheses in USE_NEW_SCHEME In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 1 Jan 2020, Randy Dunlap wrote: > [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 atmgnd: Please resend this patch to Greg Kroah-Hartman with the appropriate CC's. Also, your Signed-off-by: line should contain a real name, not an email userid (you probably don't use "atmgnd" as your signature on legal documents!). When you resend the patch, you can include: Acked-by: Alan Stern Alan Stern