From patchwork Mon Jun 20 08:19:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 70410 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1398444qgy; Mon, 20 Jun 2016 01:29:23 -0700 (PDT) X-Received: by 10.36.11.84 with SMTP id 81mr14995694itd.89.1466411363748; Mon, 20 Jun 2016 01:29:23 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9si780763pau.40.2016.06.20.01.29.23; Mon, 20 Jun 2016 01:29:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752524AbcFTI3W (ORCPT + 5 others); Mon, 20 Jun 2016 04:29:22 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:34146 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751557AbcFTI3V (ORCPT ); Mon, 20 Jun 2016 04:29:21 -0400 Received: by mail-pa0-f42.google.com with SMTP id bz2so48884181pad.1 for ; Mon, 20 Jun 2016 01:28:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=8UJ9gUq3bXISKIT15LdBPlO5pe1Lsdc6s/lCelKat3w=; b=PJFqVlcvDHyjtB/+eAkbwoByiIGiS+zwhwA9Ck6DTeLdo9T1lX6Z0Mvzt1qBgETC+h IHsl1kI+RNR24YOZxTqXwLb1UrTXaXKs31y258paPfgeqmVsITVKWeLId/ztxU7wFOUi nZTUKMmiAJanQxK1q9YRD90v2LcCKZQV2fNxA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8UJ9gUq3bXISKIT15LdBPlO5pe1Lsdc6s/lCelKat3w=; b=MQBIecBrGJvvkWecelqKGH35HZRjeLcyeHvHl43XUSD1b+2AS4/OfEH+/v2fck75/R BUCvTm25VsX/58ns6j0oepoIQnOB3cU3dEC8B25iH8dY6oMDOmfMpjqjJAbvtzyIZQQj miCzK8/P2WKhJ6OZeN6cQtfCLiQzOfCNELDGGAiDpqBKq17wFG1DwE/V7VZPmlMyU4lK Za15e80Bx4KmgRmCo1d/ekliX+yea+kV6Gh+H/SuB8U30tZlmKyG30nXIdj89avVHwSL FHQymu8tdzSmOvF7gMPg52zajmyu/HC+Fhsu6IDRbtbEPxAQ4zq1fLL3LOqRy75AFaPH OxAw== X-Gm-Message-State: ALyK8tJuWeATKiJmWtmTmCFxkQmDQE75z1c4XMVoyJBGMqBeNSNHkMvh+5N3B/5LbEdAlhIN X-Received: by 10.66.4.129 with SMTP id k1mr20601908pak.45.1466410923923; Mon, 20 Jun 2016 01:22:03 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id o6sm9677827pax.9.2016.06.20.01.22.00 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Jun 2016 01:22:03 -0700 (PDT) From: Baolin Wang To: balbi@kernel.org, gregkh@linuxfoundation.org Cc: broonie@kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org Subject: [PATCH v2] usb: dwc3: gadget: Add the suspend state checking when stopping gadget Date: Mon, 20 Jun 2016 16:19:48 +0800 Message-Id: <1c3b80c5eec16b816afd936c86d502ec70c9873a.1466410747.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org It will be crash to stop gadget when the dwc3 device had been into suspend state, thus we need to check if the dwc3 device had been into suspend state when UDC try to stop gadget. Signed-off-by: Baolin Wang --- drivers/usb/dwc3/gadget.c | 3 +++ 1 file changed, 3 insertions(+) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 6dde376..351769e 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1791,6 +1791,9 @@ err0: static void __dwc3_gadget_stop(struct dwc3 *dwc) { + if (pm_runtime_suspended(dwc->dev)) + return; + dwc3_gadget_disable_irq(dwc); __dwc3_gadget_ep_disable(dwc->eps[0]); __dwc3_gadget_ep_disable(dwc->eps[1]);