Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp12405783ybl; Sat, 28 Dec 2019 11:35:12 -0800 (PST) X-Google-Smtp-Source: APXvYqzT0OUaXSQ09zpBEWD7AR7oYhDu3DkavvSjZawx/eb7O2kl5gSgIiVpPN1RRoSv8pxCD5Hq X-Received: by 2002:a9d:6859:: with SMTP id c25mr44372977oto.205.1577561712355; Sat, 28 Dec 2019 11:35:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577561712; cv=none; d=google.com; s=arc-20160816; b=nEKtIFo9GRuiyMxfCVfRtQlCcnHLcM1YTqe+JCFKhGDgDQUOKF3dU1537t38KrcWN3 5TEfaKrQ6x3Z0MHrLWoh/wJ5KFRAa9GFCq1LXxODqBV9DhOyCAxIKWT2rlcOCxB1rYL2 puqTWXUQtB9rxcdgCxE4uctD2eUa+lv7EBtjG7G/crLyzaGmIpovFvTHm8UqBGZdjUoC /kYh4AcUFenJinVprWthZQXzST/UOGuawYTLkQHjbTIz/2Z2Zn4eKEe8rP5/FVUfuTvX ntCkiW09ncSODNUUfolOubc1PWLEtfVD5gNNmH2ouhClLt1XqdMF0bd0/tWhJz4BtYkX 21IQ== 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=hCrOzCYP3PVajyj0KSPSeOxAFP0ci9J+BzPDdYtqiGQ=; b=kE3HJd1GdICyzKv2GmRy8Lg/oH+sdTzlc9SRz9I4gjGuUdB0Wr6sCXC1C23kW/UJ7u iIqZiRa60bTqVvgDLfhxgUb8x7jCDx9h3EqrOOsreuzLfbb+pQh9DJKURLRvSv9k9KP1 3olo7DKZiEfVbYWWAWJAmer/wTVnrHHsE38aSFpVh0pe2nvixKGQntUaugtbuphF+DWX Hiq4qqWoevnY2VYIEH8Sv8UDxmyvEjS168Kjkq0r3lZ5BBjY8XNVxTCouTaU2bFyzc0Y IkszSV4uyfnjJxczKf7uzt3NQMh+yI6zQObn56DG4kpk4wpXhK0QPtfdH8e3sVppDE9B iesA== 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 l10si12840715oil.224.2019.12.28.11.34.47; Sat, 28 Dec 2019 11:35:12 -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 S1726455AbfL1TdD (ORCPT + 99 others); Sat, 28 Dec 2019 14:33:03 -0500 Received: from netrider.rowland.org ([192.131.102.5]:52985 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726371AbfL1TdD (ORCPT ); Sat, 28 Dec 2019 14:33:03 -0500 Received: (qmail 18436 invoked by uid 500); 28 Dec 2019 14:33:01 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 28 Dec 2019 14:33:01 -0500 Date: Sat, 28 Dec 2019 14:33:01 -0500 (EST) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: Guenter Roeck cc: Peter Chen , Greg Kroah-Hartman , , , Michael Grzeschik , Subject: Re: [PATCH] usb: chipidea: host: Disable port power only if previously enabled In-Reply-To: <20191227165543.GA15950@roeck-us.net> 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 Fri, 27 Dec 2019, Guenter Roeck wrote: > On Thu, Dec 26, 2019 at 02:46:15PM -0500, Alan Stern wrote: > > On Thu, 26 Dec 2019, Guenter Roeck wrote: > > > > > On shutdown, ehci_power_off() is called unconditionally to power off > > > each port, even if it was never called to power on the port. > > > For chipidea, this results in a call to ehci_ci_portpower() with a request > > > to power off ports even if the port was never powered on. > > > This results in the following warning from the regulator code. > > > > That's weird -- we should always power-on every port during hub > > initialization. > > > That is what I would have assumed, but test code shows that it doesn't > happen. > > > It looks like there's a bug in hub.c:hub_activate(): The line under > > HUB_INIT which calls hub_power_on() should call > > usb_hub_set_port_power() instead. In fact, the comment near the start > > usb_hub_set_port_power() operates on a port of the hub. hub_activate() > operates on the hub itself, or at least I think it does. I don't know > how to convert the calls. Also, there are more calls to hub_power_on() > in the same function. Can you provide more details on what to do, > or even better a patch for me to test ? Let's try a slightly different approach. What happens with this patch? Alan Stern Index: usb-devel/drivers/usb/core/hub.c =================================================================== --- usb-devel.orig/drivers/usb/core/hub.c +++ usb-devel/drivers/usb/core/hub.c @@ -1065,6 +1065,7 @@ static void hub_activate(struct usb_hub if (type == HUB_INIT) { delay = hub_power_on_good_delay(hub); + hub->power_bits[0] = ~0UL; /* All ports on */ hub_power_on(hub, false); INIT_DELAYED_WORK(&hub->init_work, hub_init_func2); queue_delayed_work(system_power_efficient_wq,