From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: balbi@ti.com, Alan Stern <stern@rowland.harvard.edu>
Cc: Kever Yang <kever.yang@rock-chips.com>,
Paul Zimmerman <paulz@synopsys.com>,
Dinh Nguyen <dinguyen@opensource.altera.com>,
romain.perier@gmail.com, Heiko Stuebner <heiko@sntech.de>,
dianders@chromium.org, sonnyrao@chromium.org,
addy.ke@rock-chips.com, cf@rock-chips.com, wulf@rock-chips.com,
huangtao@rock-chips.com, linux-rockchip@lists.infradead.org,
Roy Li <roy.li@rock-chips.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] usb: dwc2: resume root hub when device detect with suspend state
Date: Wed, 19 Nov 2014 18:06:09 +0200 [thread overview]
Message-ID: <546CBFF1.8070206@linux.intel.com> (raw)
In-Reply-To: <20141118164100.GD6179@saruman>
On 18.11.2014 18:41, Felipe Balbi wrote:
> On Tue, Nov 18, 2014 at 11:07:34AM -0500, Alan Stern wrote:
>> On Tue, 18 Nov 2014, Kever Yang wrote:
>>
>>> After we implement the bus_suspend/resume, auto suspend id enabled.
>>> The root hub will be auto suspend if there is no device connected,
>>> we need to resume the root hub when a device connect detect.
>>>
>>> This patch tested on rk3288.
>>>
>>> Signed-off-by: Roy Li <roy.li@rock-chips.com>
>>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>>> ---
>>>
>>> Changes in v2:
>>> - add definition for hcd structure
>>> - remove check for bus->root_hub
>>>
>>> drivers/usb/dwc2/hcd_intr.c | 5 +++++
>>> 1 file changed, 5 insertions(+)
>>>
>>> diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c
>>> index 551ba87..680206f 100644
>>> --- a/drivers/usb/dwc2/hcd_intr.c
>>> +++ b/drivers/usb/dwc2/hcd_intr.c
>>> @@ -329,6 +329,7 @@ static void dwc2_port_intr(struct dwc2_hsotg *hsotg)
>>> {
>>> u32 hprt0;
>>> u32 hprt0_modify;
>>> + struct usb_hcd *hcd = (struct usb_hcd *)hsotg->priv;
>>>
>>> dev_vdbg(hsotg->dev, "--Port Interrupt--\n");
>>>
>>> @@ -354,6 +355,10 @@ static void dwc2_port_intr(struct dwc2_hsotg *hsotg)
>>> hsotg->flags.b.port_connect_status = 1;
>>> hprt0_modify |= HPRT0_CONNDET;
>>>
>>> + /* resume root hub? */
>>> + if (hcd->state == HC_STATE_SUSPENDED)
>>> + usb_hcd_resume_root_hub(hcd);
>>
>> You should be aware that it's not safe to use hcd->state for anything
>> in a host controller driver. That field is owned by usbcore, not by
>> the HCD, and it is not protected by any locks.
>>
>> Thus, for example, hcd->state does not get set to HC_STATE_SUSPENDED
>> until some time after the bus_suspend routine has returned. A
>> port-change interrupt might occur during that time interval.
>
> In that case, XHCI has a bug :-) Mathias, care to add it to your TODO
> list ?
>
I guess I'll need to check it out, thanks for pointing it out.
-Mathias
prev parent reply other threads:[~2014-11-19 16:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-18 1:21 [PATCH v2] usb: dwc2: resume root hub when device detect with suspend state Kever Yang
2014-11-18 3:01 ` Doug Anderson
2014-11-18 4:35 ` Felipe Balbi
2014-11-18 16:07 ` Alan Stern
2014-11-18 16:41 ` Felipe Balbi
2014-11-19 2:03 ` Julius Werner
2014-11-19 16:00 ` Alan Stern
[not found] ` <2014111916244796336915@rock-chips.com>
2014-11-19 19:27 ` Julius Werner
2014-11-19 16:06 ` Mathias Nyman [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=546CBFF1.8070206@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=addy.ke@rock-chips.com \
--cc=balbi@ti.com \
--cc=cf@rock-chips.com \
--cc=dianders@chromium.org \
--cc=dinguyen@opensource.altera.com \
--cc=gregkh@linuxfoundation.org \
--cc=heiko@sntech.de \
--cc=huangtao@rock-chips.com \
--cc=kever.yang@rock-chips.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=paulz@synopsys.com \
--cc=romain.perier@gmail.com \
--cc=roy.li@rock-chips.com \
--cc=sonnyrao@chromium.org \
--cc=stern@rowland.harvard.edu \
--cc=wulf@rock-chips.com \
/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