From patchwork Mon Apr 11 11:35:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 65499 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp1413822lbl; Mon, 11 Apr 2016 04:36:24 -0700 (PDT) X-Received: by 10.98.80.10 with SMTP id e10mr32068789pfb.141.1460374574542; Mon, 11 Apr 2016 04:36:14 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hj1si3205215pac.235.2016.04.11.04.36.14; Mon, 11 Apr 2016 04:36:14 -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; Authentication-Results: mx.google.com; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754448AbcDKLf4 (ORCPT + 29 others); Mon, 11 Apr 2016 07:35:56 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:46455 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754133AbcDKLfx (ORCPT ); Mon, 11 Apr 2016 07:35:53 -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 u3BBZZ64020316; Mon, 11 Apr 2016 06:35:35 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id u3BBZZLO001931; Mon, 11 Apr 2016 06:35:35 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.224.2; Mon, 11 Apr 2016 06:35:34 -0500 Received: from lta0400828d.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id u3BBZ7FZ014612; Mon, 11 Apr 2016 06:35:31 -0500 From: Roger Quadros To: CC: , , , , , , , , , , , Roger Quadros Subject: [PATCH v6 07/10] usb: dwc3: gadget: Fix suspend/resume during dual-role mode Date: Mon, 11 Apr 2016 14:35:03 +0300 Message-ID: <1460374506-9779-8-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460374506-9779-1-git-send-email-rogerq@ti.com> References: <1460374506-9779-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Gadget 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(+) -- 2.5.0 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 83d5c57..1ca5ac0 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2952,6 +2952,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); @@ -2970,6 +2973,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);