Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1113099imm; Wed, 1 Aug 2018 10:23:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfI4WRxLxfofc8nevYasPE+lcQ58bP9AlFQLmSOfK7Bfz5k07thR8w9HFwg3qt+4Ybh2wod X-Received: by 2002:a63:d401:: with SMTP id a1-v6mr25240339pgh.414.1533144215554; Wed, 01 Aug 2018 10:23:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144215; cv=none; d=google.com; s=arc-20160816; b=OShMPmQRBCvvW+J3NqrheeBjWZGnflK+daMWBiFwHCgrMm+/bIEwgTamtrhTzLZjlY p3Q4UJ+OTOA0al0AB1Jz3bqYx4Kw7lfnTr+22QAAwfae5hdNxiSbcvTOvJ2Dk7Zygv3M +V70vMr2jfVWiQaMBnt9csD5qQ/lVrp8qmTqea5GaWGyluiJpeqP72oITMpzlQuZtlkw 92KCnZKHDP4P8CN/sVE+qVJ/AYf1tWV16dyYoWoXcbvpQQ6gfbVLxyDVX18UsVbyT4Rc vUrKuNCr7JjDZPn5Tgxo1UY+nQ2Ca5TCaAUXcheCh1cQCS3VY9FtcQst6uoiFzspeD6G RgoQ== 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=a795LjtTvM70BjRaz5kkjTMrqZY/BA0KQMOP+RZKNeE=; b=rA/FIY7llLeodg6cmcLkZIqtjoG4PJitW0PkkPZk+NMhktGNreiNcRaKYUhtlPBJLg 6dE+kL9DhVV8dtEWv5Xv8+MRgolUeFlCFt2ZGL88ATbIIU/NPOSgVsU5C/wKj3Ds+4wD fNV2K9wNkHpEbrRwJkhxP/DTixN6xlKuHBodNskqLxa1d/83fVezn0wg8Hdj6f8DYhKm NkSaZXp6XrCiAeHzmUM/37bWLQSg34KZHSdN+yheVqR19S/Ixk0WqB4BRW8X62gSWW81 qhejMxGC4E5MtnPq2eIK1BCLPNKzZWaisIL459frGJBDdR2jCcMODKR1RzeXV3nWx6vj OPkg== 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 a1-v6si15973016pli.472.2018.08.01.10.23.20; Wed, 01 Aug 2018 10:23:35 -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 S2405629AbeHATIZ (ORCPT + 99 others); Wed, 1 Aug 2018 15:08:25 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49410 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404973AbeHATIZ (ORCPT ); Wed, 1 Aug 2018 15:08:25 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7BAF7CF7; Wed, 1 Aug 2018 17:21:43 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dominik Bozek , Kuppuswamy Sathyanarayanan , Sasha Levin Subject: [PATCH 4.14 199/246] usb: hub: Dont wait for connect state at resume for powered-off ports Date: Wed, 1 Aug 2018 18:51:49 +0200 Message-Id: <20180801165021.240728802@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dominik Bozek [ Upstream commit 5d111f5190848d6fb1c414dc57797efea3526a2f ] wait_for_connected() wait till a port change status to USB_PORT_STAT_CONNECTION, but this is not possible if the port is unpowered. The loop will only exit at timeout. Such case take place if an over-current incident happen while system is in S3. Then during resume wait_for_connected() will wait 2s, which may be noticeable by the user. Signed-off-by: Dominik Bozek Signed-off-by: Kuppuswamy Sathyanarayanan Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hub.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -3361,6 +3361,10 @@ static int wait_for_connected(struct usb while (delay_ms < 2000) { if (status || *portstatus & USB_PORT_STAT_CONNECTION) break; + if (!port_is_power_on(hub, *portstatus)) { + status = -ENODEV; + break; + } msleep(20); delay_ms += 20; status = hub_port_status(hub, *port1, portstatus, portchange);