Received: by 10.223.185.116 with SMTP id b49csp6522625wrg; Thu, 8 Mar 2018 08:47:45 -0800 (PST) X-Google-Smtp-Source: AG47ELv8nzwKN8GNCDhRN2mza42oi1IVDE52NHXKt+yPqXcOzbKE+RlE2cTklgTJxORjSWuuO7ET X-Received: by 10.99.125.92 with SMTP id m28mr21975513pgn.257.1520527664886; Thu, 08 Mar 2018 08:47:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520527664; cv=none; d=google.com; s=arc-20160816; b=HnFyJwl16RJ/UJcaZcGQoX64kPnuoQd6yRVhVHM1JE26Ua9XwJZoXaQGTkadAftqvs 1Q5k6ACTpGJnAaYzwRc+QYVLuOh4gKT8bh5Slu9LKWf20rQhC/WgoWIuXXcqqEKO10FM uw/PfE5VE0RyMrZ7851vq1Qg8qG/2IAkJH2iXKivmOoE5ZTeckz9H5SRFYuHE7aSmePQ +VsnIyX91Gg+zqHEHDAW/deja5aSWVrdBUSlQZPgFq8kYUR1AHB3ZDdRHzLC/mnwJp0w 0xPEzkzJ0CT8xSnBg8bKFPOQlAlwcqwgVOFKrirXq22uFYhaJ2x+8geeE+fyTq/xPXr+ tQqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=9lGZlhXpoPSOWtez9v+GnxUkghO6BLJOXQKkq20MXTE=; b=Lngi1n4J/VHhzeaE/WWt/93bCjeOApEJz4Izz1Fd998VvzNSXmTPWQ6DTrmw26OTLE lICcBVFZ+06p17g0DLYDdhgnA4I6qHnPzI0q5N81lr4TvIQzFfNn5L7kzQa9aIvoCL+Z 0MiOiuDKKz2CkKQvBiZV0YAtEBUwbxEHV3WJQyUXvRwhuZiSyyaGNMHBgWs0mrJN9GbA Mgz/hzEtl+AC2Tb5Xn46Dm5M6qjldNOicnuQ1FKTY7JcDtRLNH1so1dYZwf91LlzhSjL toHf7stxS4Ni7oVESr0PjABNUC2d1/xoQgXUJIX7CJyprvuSxVqVwV+LgZ0gZG8w7BgG FOgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=XSxK2Ooa; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p25si13109677pgn.151.2018.03.08.08.47.30; Thu, 08 Mar 2018 08:47:44 -0800 (PST) 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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=XSxK2Ooa; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754551AbeCHQqR (ORCPT + 99 others); Thu, 8 Mar 2018 11:46:17 -0500 Received: from lelnx194.ext.ti.com ([198.47.27.80]:20801 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752094AbeCHQqP (ORCPT ); Thu, 8 Mar 2018 11:46:15 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w28GkDGI023234; Thu, 8 Mar 2018 10:46:13 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1520527573; bh=W2KyqbriiP57IGSsTud/mEF9U3uRfh4IvVSREjYqmpo=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=XSxK2OoaG12D50UUIud6BvS+XLYSDloqgesY9TBL64+wYAPVef1Z5I+GLUV066Tb2 BhDlpooopyw7q/9qEytrkj+DIrb2inYr2S7xlPAbsro9kSS5p6TQL9kw90z2S+QeiQ ZdWx29mXUVzcjU2n0POaLnQZ09IZNfAKYLRs9Bpk= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w28GkDHq012029; Thu, 8 Mar 2018 10:46:13 -0600 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Thu, 8 Mar 2018 10:46:13 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Thu, 8 Mar 2018 10:46:13 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w28GkDwb018047; Thu, 8 Mar 2018 10:46:13 -0600 Date: Thu, 8 Mar 2018 10:46:13 -0600 From: Bin Liu To: Merlijn Wajer CC: , , Greg Kroah-Hartman , , Subject: Re: [RFC PATCH] usb: musb: Fix external abort in musb_remove Message-ID: <20180308164613.GH14921@uda0271908> Mail-Followup-To: Bin Liu , Merlijn Wajer , ivo.g.dimitrov.75@gmail.com, linux-omap@vger.kernel.org, Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180308093121.11943-1-merlijn@wizzup.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180308093121.11943-1-merlijn@wizzup.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Thu, Mar 08, 2018 at 10:31:21AM +0100, Merlijn Wajer wrote: > This fixes an oops on unbind / module unload. The fix is similar to the > one in this commit: 0c3aae9bd59978fb8c3557d7883380bef0f2cfa1 (USB: musb: > fix late external abort on suspend), which only fixes the issue for > musb_suspend. > > musb_remove function now also flushes any work and also calls > musb_platform_exit before disabling runtime pm. > > Signed-off-by: Merlijn Wajer > --- > > If I understand commit 0c3aae9bd59978fb8c3557d7883380bef0f2cfa1 correctly, > this patch should also be backported to 4.9 (and newer kernels). > > I have verified that this works on the Nokia N900, RX-51. The problem did not > occur on the Motorola Droid 4, but I have yet to test if this patch causes > issues there. > > drivers/usb/musb/musb_core.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c > index e2e95071328a..4fb0f345c04e 100644 > --- a/drivers/usb/musb/musb_core.c > +++ b/drivers/usb/musb/musb_core.c > @@ -2472,13 +2472,19 @@ static int musb_remove(struct platform_device *pdev) > musb_platform_disable(musb); > spin_lock_irqsave(&musb->lock, flags); > musb_disable_interrupts(musb); > + > + musb->flush_irq_work = true; > + while (flush_delayed_work(&musb->irq_work)) > + ; > + musb->flush_irq_work = false; No need to flush, the work is already cancelled at this point. > + > musb_writeb(musb->mregs, MUSB_DEVCTL, 0); > + musb_platform_exit(musb); This can be move down to out side of holding the spinlock, > spin_unlock_irqrestore(&musb->lock, flags); to here. > > pm_runtime_dont_use_autosuspend(musb->controller); > pm_runtime_put_sync(musb->controller); > pm_runtime_disable(musb->controller); > - musb_platform_exit(musb); > musb_phy_callback = NULL; > if (musb->dma_controller) > musb_dma_controller_destroy(musb->dma_controller); > -- Thanks for the patch. Regards, -Bin.