From patchwork Fri Apr 13 17:42:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuppuswamy Sathyanarayanan X-Patchwork-Id: 10340699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CD53C6039A for ; Fri, 13 Apr 2018 17:45:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB247288DD for ; Fri, 13 Apr 2018 17:45:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC9A728980; Fri, 13 Apr 2018 17:45:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6948E288DD for ; Fri, 13 Apr 2018 17:45:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750849AbeDMRnA (ORCPT ); Fri, 13 Apr 2018 13:43:00 -0400 Received: from mga18.intel.com ([134.134.136.126]:49168 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750808AbeDMRnA (ORCPT ); Fri, 13 Apr 2018 13:43:00 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Apr 2018 10:42:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,446,1517904000"; d="scan'208";a="33193566" Received: from skuppusw-desk.jf.intel.com ([10.7.198.163]) by orsmga007.jf.intel.com with ESMTP; 13 Apr 2018 10:42:59 -0700 From: sathyanarayanan.kuppuswamy@linux.intel.com To: gregkh@linuxfoundation.org, mathias.nyman@linux.intel.com, heikki.krogerus@intel.com, felipe.balbi@linux.intel.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, sathyaosid@gmail.com, sathyanarayanan.kuppuswamy@linux.intel.com, Dominik Bozek Subject: [PATCH v1 1/1] usb: hub: Don't wait for connect state at resume for powered-off ports Date: Fri, 13 Apr 2018 10:42:31 -0700 Message-Id: <1087e55507b290d9d22d6d2d53cff0a11b152e1c.1523641017.git.sathyanarayanan.kuppuswamy@linux.intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dominik Bozek 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 --- drivers/usb/core/hub.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index c5c1f6c..bd2b136 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -3367,6 +3367,10 @@ static int wait_for_connected(struct usb_device *udev, 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);