From patchwork Fri Sep 18 14:42:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Nyman X-Patchwork-Id: 53884 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 87E31218E3 for ; Fri, 18 Sep 2015 14:38:57 +0000 (UTC) Received: by lamp12 with SMTP id p12sf18542713lam.2 for ; Fri, 18 Sep 2015 07:38:56 -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=cKA3VZuayj18GryQvJCrI5AkWAkM38dpA0AU5FswKRs=; b=QtHuJHbLFpaFGyzRZ2jEWlNqivmcqcMBewV/NgKUuSwzdE1IuuPEzS0R0xIWQg9Psn Kf5vWNFL0/KUkmUbPIqrJh7AWcpDK15h5h2dT7HCa9agls2A09NHLTgwQJzve1eFr6XX 5KDq8RdC4y9yjsvCqUKaAJVYJsWB1roOSigRNvhXjYwkXtnbBT/FZb/KO8oa7F65Zocn //BGPmYhIQnwLl/vIKBJo4wRmn9FMn1Seq4oUGoTwZlbIwTK1DBSHq5MvSbLGt+lTD/6 yU5Oudwjl6kkFdGuQUmqXb5RyGF0LdPlwn9NwaOWr6Jy8QMKIR5US9OD1hG2GAqNtobS f1yA== X-Gm-Message-State: ALoCoQmh1L724Usmm6dyUYNsOeFQOO87v3AWqUHrux1Jhy/2II/5+XmhWmB9AAzqAewE+NubzmCK X-Received: by 10.181.29.103 with SMTP id jv7mr652643wid.0.1442587136483; Fri, 18 Sep 2015 07:38:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.108 with SMTP id kx12ls244482lac.72.gmail; Fri, 18 Sep 2015 07:38:56 -0700 (PDT) X-Received: by 10.152.19.169 with SMTP id g9mr3336034lae.124.1442587136361; Fri, 18 Sep 2015 07:38:56 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id r11si6201995lby.12.2015.09.18.07.38.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Sep 2015 07:38:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by lanb10 with SMTP id b10so31637281lan.3 for ; Fri, 18 Sep 2015 07:38:56 -0700 (PDT) X-Received: by 10.112.129.202 with SMTP id ny10mr3258994lbb.112.1442587136081; Fri, 18 Sep 2015 07:38:56 -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 w3csp334202lbq; Fri, 18 Sep 2015 07:38:54 -0700 (PDT) X-Received: by 10.66.144.135 with SMTP id sm7mr7735566pab.106.1442587120761; Fri, 18 Sep 2015 07:38:40 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id zv8si14045210pbc.164.2015.09.18.07.38.40; Fri, 18 Sep 2015 07:38:40 -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 S1753141AbbIROih (ORCPT + 4 others); Fri, 18 Sep 2015 10:38:37 -0400 Received: from mga01.intel.com ([192.55.52.88]:19092 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752624AbbIROiZ (ORCPT ); Fri, 18 Sep 2015 10:38:25 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 18 Sep 2015 07:38:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,553,1437462000"; d="scan'208";a="564275854" Received: from mattu-haswell.fi.intel.com ([10.237.72.176]) by FMSMGA003.fm.intel.com with ESMTP; 18 Sep 2015 07:38:12 -0700 From: Mathias Nyman To: Cc: , Roger Quadros , Mathias Nyman Subject: [PATCH 6/9] usb: xhci: stop everything on the first call to xhci_stop Date: Fri, 18 Sep 2015 17:42:10 +0300 Message-Id: <1442587333-21056-7-git-send-email-mathias.nyman@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442587333-21056-1-git-send-email-mathias.nyman@linux.intel.com> References: <1442587333-21056-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.53 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. 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). */