Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp892546yba; Thu, 9 May 2019 07:33:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxoF+p/dNUT1KWdamZz6gTE8MVQtJQ8CEIRtbEQelNh3imZRkjRfVnhGrN02HYclWWtpjv4 X-Received: by 2002:a65:6659:: with SMTP id z25mr6000852pgv.10.1557412394695; Thu, 09 May 2019 07:33:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557412394; cv=none; d=google.com; s=arc-20160816; b=LWbBATOWKaemXV5I3EBZvNWHAvZv7/emfaN27lgO97c3x6dBaWBFeb+8HCtREG0DjH C+iZT3Wykjm1+ic89IebCbKOPQSDbKiINN9+fVQP9dCkF6MuweMFvtYjdyt6QW1ITicM E/de+qbdwowvfFe+2BkGh5EuNczmkDzM8SwvC71xss4oZUJArZSofaXpWDDOuMRW6Xim RK3kswRpG3yk5VZ/8TykNETkgltGGpbQfgcY9sbPPvcKm5+vevcpM0rjNIOl6a7nGLut ZyjQF5Ewxl67uiP0asZJwS87OK7SiPS+yRYZGIswlhpXgRCRU1A5/ZXaMi8+YIbLPu04 ZaVg== 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=jD6VsncGUASodAlMCr06ulpxg1yCsE1SohvdejxX014=; b=a40R6xr4ctWGMoyYp2+Zh2WQQvH8UXRNWAUU50Qlm+f/5HVgKzNtsA7aE3V/VQDgHq rnR8/y7I58vJ348LGdFI77Li6AlafQBzy6HCFH1Yyt5M5jM0jFLmbxEZQFMKdUux8pSj 6E3yCuczg6B/znEAYFH6YEQzX/M2tWqpaFBj/P1bg1wOd2Tii7rLFGtrM/4CQ3gv3+Kl 1H8LV6gxsL6Btr0SVgN9KTPivKnrWUP0rvo9EnvzPkpkQ4or4Ihqj4u/yvDyMdCJqHwq 8PTbgSfNLK+lLFEzFmdI7d92XlltVF7N97zTQAH/XGgB455tEAlxDwQ/OoIgNwGZNy7A v6sQ== 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 m134si3195532pga.588.2019.05.09.07.32.58; Thu, 09 May 2019 07:33:14 -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 S1726838AbfEIOcB (ORCPT + 99 others); Thu, 9 May 2019 10:32:01 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:43782 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726704AbfEIOcA (ORCPT ); Thu, 9 May 2019 10:32:00 -0400 Received: (qmail 14260 invoked by uid 2102); 9 May 2019 10:31:59 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 9 May 2019 10:31:59 -0400 Date: Thu, 9 May 2019 10:31:59 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Greg KH cc: Jim Lin , , , , , , , , , Subject: Re: [PATCH v7 1/1] usb: xhci: Add Clear_TT_Buffer In-Reply-To: <20190509122534.GA31542@kroah.com> 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 Thu, 9 May 2019, Greg KH wrote: > On Thu, May 09, 2019 at 08:03:15PM +0800, Jim Lin wrote: > > --- a/include/linux/usb.h > > +++ b/include/linux/usb.h > > @@ -625,6 +625,7 @@ struct usb3_lpm_parameters { > > * parent->hub_delay + wHubDelay + tTPTransmissionDelay (40ns) > > * > > * Will be used as wValue for SetIsochDelay requests. > > + * @devaddr: address on a USB bus, assigned by controller like XHCI > > * > > * Notes: > > * Usbcore drivers should not set usbdev->state directly. Instead use > > @@ -709,6 +710,7 @@ struct usb_device { > > unsigned lpm_disable_count; > > > > u16 hub_delay; > > + int devaddr; > > Shouldn't this be u32? In fact the device address is an unsigned 7-bit value. The size of the variable we store it in doesn't matter much. BUT! If it's going to be stored in a regular int then it's foolish to leave a 16-bit gap between it and the preceding field in the structure. It should be added at some appropriate spot in the structure, not at the end. Overall I think this should be broken up into two patches: one to introduce the new field and one to implement Clear-TT-Buffer for xHCI. Furthermore, update_devnum() in hub.c should do: if (udev->devaddr == 0) udev->devaddr = devnum; Then the code usb_hub_clear_tt_buffer() can just use devaddr without needing to check the HCD type. Alan Stern