linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Wesley Cheng <wcheng@codeaurora.org>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, jackp@codeaurora.org
Subject: Re: [PATCH v2] usb: dwc3: gadget: Avoid runtime resume if disabling pullup
Date: Wed, 04 Aug 2021 13:41:02 +0300	[thread overview]
Message-ID: <87r1f95w6q.fsf@kernel.org> (raw)
In-Reply-To: <1628058245-30692-1-git-send-email-wcheng@codeaurora.org>


Wesley Cheng <wcheng@codeaurora.org> writes:

> If the device is already in the runtime suspended state, any call to
> the pullup routine will issue a runtime resume on the DWC3 core
> device.  If the USB gadget is disabling the pullup, then avoid having
> to issue a runtime resume, as DWC3 gadget has already been
> halted/stopped.
>
> This fixes an issue where the following condition occurs:
>
> usb_gadget_remove_driver()
> -->usb_gadget_disconnect()
>  -->dwc3_gadget_pullup(0)
>   -->pm_runtime_get_sync() -> ret = 0
>   -->pm_runtime_put() [async]
> -->usb_gadget_udc_stop()
>  -->dwc3_gadget_stop()
>   -->dwc->gadget_driver = NULL
> ...
>
> dwc3_suspend_common()
> -->dwc3_gadget_suspend()
>  -->DWC3 halt/stop routine skipped, driver_data == NULL
>
> This leads to a situation where the DWC3 gadget is not properly
> stopped, as the runtime resume would have re-enabled EP0 and event
> interrupts, and since we avoided the DWC3 gadget suspend, these
> resources were never disabled.
>
> Fixes: 77adb8bdf422 ("usb: dwc3: gadget: Allow runtime suspend if UDC unbinded")
> Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>

Acked-by: Felipe Balbi <balbi@kernel.org>

-- 
balbi

      reply	other threads:[~2021-08-04 10:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04  6:24 [PATCH v2] usb: dwc3: gadget: Avoid runtime resume if disabling pullup Wesley Cheng
2021-08-04 10:41 ` Felipe Balbi [this message]

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=87r1f95w6q.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jackp@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=wcheng@codeaurora.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).