From patchwork Wed Sep 2 14:24:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 52975 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id B1FC72300B for ; Wed, 2 Sep 2015 14:25:10 +0000 (UTC) Received: by wicgc1 with SMTP id gc1sf7018733wic.3 for ; Wed, 02 Sep 2015 07:25:10 -0700 (PDT) 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:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=8yCJTwHGSVWpayHoe9RdX1UqoFoKjOdRRhB0G6T67hk=; b=IhK73x8te/Nv7l9khFEoXOipkdalnp4XG3RRDqFVvCU9RcfLz/jjOYUjWPF1PuBJq9 +Lh8ukEntK0UsP+DfnpesqoZUDp2V0rEGzXS45wPAl59QS0ty67Dm8csNoKhjMxtTYqT o5DsQKKwj4f8QiHaFqmtqYekqUUM2cbHkNm/9XExeIHpOjbSeP4/KgguBsCK7bn8bOjT rLNVqG/eHugyloRzzEBiOQcgfsFT5NbedeqZTiCbhZdmWEZSzE5IWD9X56Pcds0hxN6i 9D9kYQW6aqvN+V1s6R1zupeoXvdN3k2fsndFWEo/Ntjxuuo0PRK0OPSXhHMwgssxPp+T K89w== X-Gm-Message-State: ALoCoQlUI3kl2wNQwNKIA8efN1rWRFfIiJoRHN8IhOhBSFGFw3d/SC2exVCPezOE/GKLppWqhZ6s X-Received: by 10.180.87.199 with SMTP id ba7mr1103634wib.5.1441203910028; Wed, 02 Sep 2015 07:25:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.227 with SMTP id n3ls99095lan.0.gmail; Wed, 02 Sep 2015 07:25:09 -0700 (PDT) X-Received: by 10.152.18.194 with SMTP id y2mr6738452lad.88.1441203909848; Wed, 02 Sep 2015 07:25:09 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id u2si19789785laj.34.2015.09.02.07.25.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Sep 2015 07:25:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbcjc2 with SMTP id jc2so7090768lbc.0 for ; Wed, 02 Sep 2015 07:25:09 -0700 (PDT) X-Received: by 10.152.22.133 with SMTP id d5mr15764701laf.112.1441203909732; Wed, 02 Sep 2015 07:25:09 -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.164.42 with SMTP id yn10csp614808lbb; Wed, 2 Sep 2015 07:25:08 -0700 (PDT) X-Received: by 10.68.57.143 with SMTP id i15mr15704538pbq.104.1441203904958; Wed, 02 Sep 2015 07:25:04 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vr1si32358668pab.21.2015.09.02.07.25.04; Wed, 02 Sep 2015 07:25:04 -0700 (PDT) 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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754924AbbIBOY5 (ORCPT + 28 others); Wed, 2 Sep 2015 10:24:57 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:56939 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753929AbbIBOYy (ORCPT ); Wed, 2 Sep 2015 10:24:54 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id t82EOnio014658; Wed, 2 Sep 2015 09:24:49 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t82EOn4f005651; Wed, 2 Sep 2015 09:24:49 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Wed, 2 Sep 2015 09:24:49 -0500 Received: from rockdesk.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t82EOPFU024150; Wed, 2 Sep 2015 09:24:47 -0500 From: Roger Quadros To: CC: , , , , , , , , Roger Quadros Subject: [PATCH v4 7/9] usb: dwc3: gadget: Fix suspend/resume during dual-role mode Date: Wed, 2 Sep 2015 17:24:22 +0300 Message-ID: <1441203864-15786-8-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1441203864-15786-1-git-send-email-rogerq@ti.com> References: <1441203864-15786-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: rogerq@ti.com 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.175 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: , Gdget controller might not be always active during suspend/ resume when we are operating in dual-role/otg mode. Check if we're active and only if we are then perform necessary actions during suspend/resume. Signed-off-by: Roger Quadros --- drivers/usb/dwc3/gadget.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 1148ec8..ec6112d 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2792,6 +2792,9 @@ void dwc3_gadget_exit(struct dwc3 *dwc) int dwc3_gadget_suspend(struct dwc3 *dwc) { + if (!dwc->gadget_driver) + return 0; + if (dwc->pullups_connected) { dwc3_gadget_disable_irq(dwc); dwc3_gadget_run_stop(dwc, true, true); @@ -2810,6 +2813,9 @@ int dwc3_gadget_resume(struct dwc3 *dwc) struct dwc3_ep *dep; int ret; + if (!dwc->gadget_driver) + return 0; + /* Start with SuperSpeed Default */ dwc3_gadget_ep0_desc.wMaxPacketSize = cpu_to_le16(512);