From patchwork Wed Jun 24 13:59:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Nyman X-Patchwork-Id: 214810 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04643C433E0 for ; Wed, 24 Jun 2020 13:56:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D8AC320724 for ; Wed, 24 Jun 2020 13:56:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404000AbgFXN4y (ORCPT ); Wed, 24 Jun 2020 09:56:54 -0400 Received: from mga02.intel.com ([134.134.136.20]:43621 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403988AbgFXN4x (ORCPT ); Wed, 24 Jun 2020 09:56:53 -0400 IronPort-SDR: 3MSPoUC55S6kawWRJIWwwEm991ipDYXzGcFxkXdHlCFLN63rd0NfB3VmEJEs2qH+RXbpEADz9Q Ykd+Fakalm+g== X-IronPort-AV: E=McAfee;i="6000,8403,9661"; a="132909267" X-IronPort-AV: E=Sophos;i="5.75,275,1589266800"; d="scan'208";a="132909267" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2020 06:56:52 -0700 IronPort-SDR: QZC3rZlRDVXUALtvInsbMnADpN+lK5GiIzU3JSxxWKKAKyTS85r3WurtP7PXi4moQR3hQgMWYb iarqqjAhx59g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,275,1589266800"; d="scan'208";a="263644049" Received: from mattu-haswell.fi.intel.com ([10.237.72.170]) by fmsmga007.fm.intel.com with ESMTP; 24 Jun 2020 06:56:51 -0700 From: Mathias Nyman To: Cc: , Macpaul Lin , stable@vger.kernel.org, Mathias Nyman Subject: [PATCH 3/5] usb: host: xhci-mtk: avoid runtime suspend when removing hcd Date: Wed, 24 Jun 2020 16:59:47 +0300 Message-Id: <20200624135949.22611-4-mathias.nyman@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200624135949.22611-1-mathias.nyman@linux.intel.com> References: <20200624135949.22611-1-mathias.nyman@linux.intel.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Macpaul Lin When runtime suspend was enabled, runtime suspend might happen when xhci is removing hcd. This might cause kernel panic when hcd has been freed but runtime pm suspend related handle need to reference it. Signed-off-by: Macpaul Lin Reviewed-by: Chunfeng Yun Cc: stable@vger.kernel.org Signed-off-by: Mathias Nyman --- drivers/usb/host/xhci-mtk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index bfbdb3ceed29..4311d4c9b68d 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c @@ -587,6 +587,9 @@ static int xhci_mtk_remove(struct platform_device *dev) struct xhci_hcd *xhci = hcd_to_xhci(hcd); struct usb_hcd *shared_hcd = xhci->shared_hcd; + pm_runtime_put_noidle(&dev->dev); + pm_runtime_disable(&dev->dev); + usb_remove_hcd(shared_hcd); xhci->shared_hcd = NULL; device_init_wakeup(&dev->dev, false); @@ -597,8 +600,6 @@ static int xhci_mtk_remove(struct platform_device *dev) xhci_mtk_sch_exit(mtk); xhci_mtk_clks_disable(mtk); xhci_mtk_ldos_disable(mtk); - pm_runtime_put_sync(&dev->dev); - pm_runtime_disable(&dev->dev); return 0; }