linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabrice Gasnier <fabrice.gasnier@st.com>
To: <hminas@synopsys.com>
Cc: <gregkh@linuxfoundation.org>, <balbi@ti.com>,
	<johnyoun@synopsys.com>, <gregory.herrero@intel.com>,
	<Grigor.Tovmasyan@synopsys.com>, <amelie.delaunay@st.com>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>
Subject: [PATCH] usb: dwc2: only prevent new request when power_down is possible
Date: Fri, 10 Apr 2020 16:31:54 +0200	[thread overview]
Message-ID: <1586529114-25211-1-git-send-email-fabrice.gasnier@st.com> (raw)

When controller is suspended, registers mustn't be touched. This is not
the case when 'power_down' is set to none. In this case, power saving
routines are skipped.

This fixes a case where gadget driver (f_acm) gets opened (cat /dev/ttyGS0)
but the bus has been suspended by the host:
- configfs-gadget gadget: acm ttyGS0 can't notify serial state, -11

Fixes: 7ababa926c66 ("usb: dwc2: gadget: prevent new request submission during suspend")
Fixes: 88b02f2cb1e1 ("usb: dwc2: Add core state checking")

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 drivers/usb/dwc2/gadget.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 92ed32e..45a8782 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -1375,7 +1375,8 @@ static int dwc2_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req,
 		req->zero, req->short_not_ok);
 
 	/* Prevent new request submission when controller is suspended */
-	if (hs->lx_state != DWC2_L0) {
+	if (hs->params.power_down != DWC2_POWER_DOWN_PARAM_NONE &&
+	    hs->lx_state != DWC2_L0) {
 		dev_dbg(hs->dev, "%s: submit request only in active state\n",
 			__func__);
 		return -EAGAIN;
-- 
2.7.4


             reply	other threads:[~2020-04-10 14:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-10 14:31 Fabrice Gasnier [this message]
2020-04-13  8:56 ` [PATCH] usb: dwc2: only prevent new request when power_down is possible Minas Harutyunyan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1586529114-25211-1-git-send-email-fabrice.gasnier@st.com \
    --to=fabrice.gasnier@st.com \
    --cc=Grigor.Tovmasyan@synopsys.com \
    --cc=amelie.delaunay@st.com \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gregory.herrero@intel.com \
    --cc=hminas@synopsys.com \
    --cc=johnyoun@synopsys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).