From patchwork Thu Nov 6 06:27:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 40251 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4A9B8245D4 for ; Thu, 6 Nov 2014 06:28:31 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id ge10sf1333322lab.5 for ; Wed, 05 Nov 2014 22:28:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=tqvSxml4lAj1d2scXT+jaZvx81+j38zV5GINaVLrX74=; b=H932rvOdru6PzIiXMbItyJeISYFClVBuNHoCktbns4gqRTfwlza6/cnIQ2/CGCQBTf oabDDFC18lg+xMHyVMyzGC3Zx52jNIRKXjCtlNzFWHq6lo0dNalauTMApf1IKhbFr759 EsM5FU2rViDyndJYrtpUQGLCEob11cLH9kWg1AZSFZygDwqD900KAxDiijRr3Vjm08wT 3lxyY5ve0MtFrm6o2XGbMBCx2c9guymEdmR8LdMqA5PlCY7GNF18Ssx05w6aPLdYBv1w mZ8u6vvlym2OA9hPkGF5C4PWNyCNchEJb3lfaLmC1lq6QmMz/znVUsyjWLPOiZJnF72Y 1/yQ== X-Gm-Message-State: ALoCoQlQIfQNA4WA1OZPjM+jBNDmBG/MVvZiSh6joXF5Zz81rGJDaKGXGKEiJOD61ipKUM6SpTv4 X-Received: by 10.194.91.180 with SMTP id cf20mr294587wjb.4.1415255310288; Wed, 05 Nov 2014 22:28:30 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.9 with SMTP id ls9ls38657lac.44.gmail; Wed, 05 Nov 2014 22:28:30 -0800 (PST) X-Received: by 10.152.116.47 with SMTP id jt15mr2414811lab.13.1415255310183; Wed, 05 Nov 2014 22:28:30 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id j6si9836484laa.71.2014.11.05.22.28.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Nov 2014 22:28:29 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id l4so359968lbv.12 for ; Wed, 05 Nov 2014 22:28:29 -0800 (PST) X-Received: by 10.152.29.8 with SMTP id f8mr2499868lah.56.1415255309751; Wed, 05 Nov 2014 22:28:29 -0800 (PST) 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.184.201 with SMTP id ew9csp2084lbc; Wed, 5 Nov 2014 22:28:29 -0800 (PST) X-Received: by 10.66.220.34 with SMTP id pt2mr119183pac.142.1415255308161; Wed, 05 Nov 2014 22:28:28 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fp12si1071584pad.23.2014.11.05.22.28.27 for ; Wed, 05 Nov 2014 22:28:28 -0800 (PST) Received-SPF: none (google.com: linux-usb-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751358AbaKFG20 (ORCPT + 3 others); Thu, 6 Nov 2014 01:28:26 -0500 Received: from mail-bn1bon0146.outbound.protection.outlook.com ([157.56.111.146]:54828 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751151AbaKFG2Y (ORCPT ); Thu, 6 Nov 2014 01:28:24 -0500 Received: from BN1PR0301MB0772.namprd03.prod.outlook.com (25.160.78.153) by BN1PR0301MB0660.namprd03.prod.outlook.com (25.160.171.21) with Microsoft SMTP Server (TLS) id 15.1.11.14; Thu, 6 Nov 2014 06:28:21 +0000 Received: from CH1PR03CA003.namprd03.prod.outlook.com (10.255.156.148) by BN1PR0301MB0772.namprd03.prod.outlook.com (25.160.78.153) with Microsoft SMTP Server (TLS) id 15.1.11.14; Thu, 6 Nov 2014 06:28:20 +0000 Received: from BL2FFO11FD052.protection.gbl (10.255.156.132) by CH1PR03CA003.outlook.office365.com (10.255.156.148) with Microsoft SMTP Server (TLS) id 15.1.16.15 via Frontend Transport; Thu, 6 Nov 2014 06:28:20 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD052.mail.protection.outlook.com (10.173.161.214) with Microsoft SMTP Server (TLS) id 15.1.6.13 via Frontend Transport; Thu, 6 Nov 2014 06:28:20 +0000 Received: from peterchendt.ap.freescale.net ([10.192.185.78]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id sA66SBrv023626; Wed, 5 Nov 2014 23:28:17 -0700 From: Peter Chen To: CC: , , , Peter Chen Subject: [PATCH v2 02/17] usb: musb: gadget: use udc-core's reset notifier Date: Thu, 6 Nov 2014 14:27:54 +0800 Message-ID: <1415255289-19540-3-git-send-email-peter.chen@freescale.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1415255289-19540-1-git-send-email-peter.chen@freescale.com> References: <1415255289-19540-1-git-send-email-peter.chen@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(87286001)(46102003)(87936001)(92566001)(50986999)(31966008)(76176999)(62966003)(102836001)(50466002)(64706001)(93916002)(86362001)(36756003)(48376002)(47776003)(33646002)(77156002)(4396001)(19580405001)(50226001)(6806004)(68736004)(44976005)(89996001)(99396003)(104016003)(120916001)(21056001)(88136002)(105606002)(106466001)(110136001)(19580395003)(104166001)(97736003)(20776003)(92726001)(95666004)(107046002)(2351001)(84676001)(229853001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN1PR0301MB0772; H:tx30smr01.am.freescale.net; FPR:; MLV:sfv; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BN1PR0301MB0772; X-Exchange-Antispam-Report-Test: UriScan:; X-Forefront-PRVS: 0387D64A71 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BN1PR0301MB0660; X-OriginatorOrg: freescale.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.217.181 as permitted sender) smtp.mail=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: Felipe Balbi Replace usb_gadget_driver's disconnect with udc-core's reset notifier at bus reset handler. Signed-off-by: Felipe Balbi Signed-off-by: Peter Chen --- drivers/usb/musb/musb_gadget.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 56c31b7..49b04cb 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -2083,9 +2083,12 @@ __acquires(musb->lock) : NULL ); - /* report disconnect, if we didn't already (flushing EP state) */ - if (musb->g.speed != USB_SPEED_UNKNOWN) - musb_g_disconnect(musb); + /* report reset, if we didn't already (flushing EP state) */ + if (musb->gadget_driver && musb->g.speed != USB_SPEED_UNKNOWN) { + spin_unlock(&musb->lock); + usb_gadget_udc_reset(&musb->g, musb->gadget_driver); + spin_lock(&musb->lock); + } /* clear HR */ else if (devctl & MUSB_DEVCTL_HR)