From patchwork Mon Sep 21 14:46:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Nyman X-Patchwork-Id: 53964 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id C52C622B1E for ; Mon, 21 Sep 2015 14:42:40 +0000 (UTC) Received: by lanb10 with SMTP id b10sf42754186lan.3 for ; Mon, 21 Sep 2015 07:42:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=9BhANgZw5jYWoXZ3z0wSjR+EE/JgRaoqERLLfeQa07U=; b=Bwz+cA44WmtrE0dgUztIUGWUUtWIIqvgkk5lsshLB0hM4SALGhE+2qG5/qPjcrlRCz scmVc68E2oxVT+sq2oBUpmpj2+xOfbZsL1ldXh0sKPRWq7Opg7jS+xTfDdt4z4HJkQjP J2Npwg6XG0Jjb1LnxQvxu3knxSgZ2pID7qaiyL7td2caKIpPD84nV6xj/JBUb7H6Ytrs z6Wde5ob8/TiudOhlNqmbH45ZjtgT67AfbvQD1vYtjqQhNT/Rx0bJZGkk+PfIT5c6Vqp J0rtCHY9h3h068eeLPu/1yJe0mw4gSmtABdewIrOlBfpCRIBYXKz47IfePNFCHyJb7Rd mIHQ== X-Gm-Message-State: ALoCoQmuyNrEUC/6Ur11XpNMAdWH8DlVtpkmHpXpz4qBV7n7t+mgJLFP8M0tYbBP3p4uIS7cDefN X-Received: by 10.112.130.41 with SMTP id ob9mr3273224lbb.17.1442846559882; Mon, 21 Sep 2015 07:42:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.87.8 with SMTP id l8ls22148lfb.92.gmail; Mon, 21 Sep 2015 07:42:39 -0700 (PDT) X-Received: by 10.25.19.73 with SMTP id j70mr1471956lfi.29.1442846559513; Mon, 21 Sep 2015 07:42:39 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id sa4si13933125lab.132.2015.09.21.07.42.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2015 07:42:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by lanb10 with SMTP id b10so68859504lan.3 for ; Mon, 21 Sep 2015 07:42:39 -0700 (PDT) X-Received: by 10.25.20.80 with SMTP id k77mr1465492lfi.117.1442846559390; Mon, 21 Sep 2015 07:42:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1753712lbq; Mon, 21 Sep 2015 07:42:38 -0700 (PDT) X-Received: by 10.68.192.9 with SMTP id hc9mr25279866pbc.57.1442846555360; Mon, 21 Sep 2015 07:42:35 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ax2si38238984pbc.170.2015.09.21.07.42.35; Mon, 21 Sep 2015 07:42:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756668AbbIUOmY (ORCPT + 4 others); Mon, 21 Sep 2015 10:42:24 -0400 Received: from mga14.intel.com ([192.55.52.115]:26736 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756539AbbIUOmY (ORCPT ); Mon, 21 Sep 2015 10:42:24 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 21 Sep 2015 07:42:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,568,1437462000"; d="scan'208";a="809845989" Received: from mattu-haswell.fi.intel.com ([10.237.72.176]) by fmsmga002.fm.intel.com with ESMTP; 21 Sep 2015 07:42:20 -0700 From: Mathias Nyman To: Cc: , Roger Quadros , , Mathias Nyman Subject: [PATCH v2 6/9] usb: xhci: stop everything on the first call to xhci_stop Date: Mon, 21 Sep 2015 17:46:14 +0300 Message-Id: <1442846777-18389-7-git-send-email-mathias.nyman@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442846777-18389-1-git-send-email-mathias.nyman@linux.intel.com> References: <1442846777-18389-1-git-send-email-mathias.nyman@linux.intel.com> Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Roger Quadros xhci_stop will be called twice, once for the shared hcd and again for the primary hcd. We stop the XHCI controller in any case so clean up everything on the first call else we can timeout waiting for pending requests to complete. Cc: Signed-off-by: Roger Quadros Signed-off-by: Mathias Nyman --- drivers/usb/host/xhci.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 5fe2419..f881d5a 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -655,15 +655,6 @@ int xhci_run(struct usb_hcd *hcd) } EXPORT_SYMBOL_GPL(xhci_run); -static void xhci_only_stop_hcd(struct usb_hcd *hcd) -{ - struct xhci_hcd *xhci = hcd_to_xhci(hcd); - - spin_lock_irq(&xhci->lock); - xhci_halt(xhci); - spin_unlock_irq(&xhci->lock); -} - /* * Stop xHCI driver. * @@ -678,15 +669,14 @@ void xhci_stop(struct usb_hcd *hcd) u32 temp; struct xhci_hcd *xhci = hcd_to_xhci(hcd); - mutex_lock(&xhci->mutex); - - if (!usb_hcd_is_primary_hcd(hcd)) { - xhci_only_stop_hcd(xhci->shared_hcd); - mutex_unlock(&xhci->mutex); + if (xhci->xhc_state & XHCI_STATE_HALTED) return; - } + mutex_lock(&xhci->mutex); spin_lock_irq(&xhci->lock); + xhci->xhc_state |= XHCI_STATE_HALTED; + xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; + /* Make sure the xHC is halted for a USB3 roothub * (xhci_stop() could be called as part of failed init). */