From patchwork Fri Jun 17 10:37:39 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: 70311 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp208874qgy; Fri, 17 Jun 2016 03:38:45 -0700 (PDT) X-Received: by 10.98.113.4 with SMTP id m4mr1757906pfc.22.1466159925798; Fri, 17 Jun 2016 03:38:45 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d185si11901522pfa.76.2016.06.17.03.38.45; Fri, 17 Jun 2016 03:38:45 -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 S1752668AbcFQKin (ORCPT + 5 others); Fri, 17 Jun 2016 06:38:43 -0400 Received: from mail-pf0-f174.google.com ([209.85.192.174]:32928 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751301AbcFQKin (ORCPT ); Fri, 17 Jun 2016 06:38:43 -0400 Received: by mail-pf0-f174.google.com with SMTP id i123so26042224pfg.0 for ; Fri, 17 Jun 2016 03:38:42 -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=5DZClUqPVLRHY/fzKXhJ3NNhCtGRJNYTeW0baWk21HE=; b=cHY7hA5Www3ZOMkIzZbI9tmtZ0VCo2D84vafFxzx007Mq8NrIwBtgJa2ydkqxyvyS8 6M6lBDreFMrk2gL9IwOJMRlHiJkBRm6dSQUS5M5X2mvk5gpfLmK+37f9FeVBKyOCyyg7 4C1wcx1iJM3N/pkEKumpf0h/DMhrx4gffZJ4E= 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=5DZClUqPVLRHY/fzKXhJ3NNhCtGRJNYTeW0baWk21HE=; b=BGRcdhAjvr7B7LESJIoT4xwImP9sCCq7Wcj1oYa1kKBzZKmifvRqdAlSW6AZkw89mm WMsQJyFmoAYCcJVlGU5rugA/0btNYxhsJVXHxCesDbOhkp5ZmBYEDlRkH7UhpvRbXhmv GziKnh1CCo1nGNSa3LHOdf2W+AJ3zH4L++H6MlkB6pCHICM41ON4WrNH7FqEoJcLA0fK 3RQQLcSKtK8JVmImBE4U6prfv69+/a91kp3gXLSj0n6rfijYRF7oRFoVcN3xAgaZHPFr zwnKGsf0WDrySFi6naOZ02N3oJluxO3BfqKvWQUvTZfTftN2JM5Sjclb0bJagpo6ekue EaZw== X-Gm-Message-State: ALyK8tJev3aPjGLZxQwP/lSSNsaJjZMO4OMUlmbkJeEaAj+SAUBM3tERNSPFEpYC0fFqi/bf X-Received: by 10.98.64.21 with SMTP id n21mr1678584pfa.161.1466159922348; Fri, 17 Jun 2016 03:38:42 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id o12sm27212717pfg.10.2016.06.17.03.38.39 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Jun 2016 03:38:41 -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] usb: dwc3: gadget: Add the suspend state checking when stopping gadget Date: Fri, 17 Jun 2016 18:37:39 +0800 Message-Id: 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. By the way I have rebased on your 'testing/next' branch. 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]);