lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 18 May 2016 14:21:32 +0300
From:	Felipe Balbi <balbi@...nel.org>
To:	Baolin Wang <baolin.wang@...aro.org>
Cc:	Greg KH <gregkh@...uxfoundation.org>,
	Mark Brown <broonie@...nel.org>,
	USB <linux-usb@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] dwc3: gadget: Defer starting the gadget device until gadget is power on


Hi,

Baolin Wang <baolin.wang@...aro.org> writes:
>>>>> @@ -1748,15 +1754,25 @@ static int dwc3_gadget_start(struct usb_gadget *g,
>>>>>          * even though host mode might be active. Don't actually perform
>>>>>          * device-specific initialization until device mode is activated.
>>>>>          */
>>>>>
>>>>> +       if (pm_runtime_suspended(dwc->dev)) {
>>>>> +               spin_unlock_irqrestore(&dwc->lock, flags);
>>>>> +               return 0;
>>>>> +       }
>>>>>
>>>>> +       ret = __dwc3_gadget_start(dwc);
>>>>> +       if (ret)
>>>>> +               goto err1;
>>>>>
>>>>> So I think the dwc3 core can enter suspend mode before gadget function
>>>>> is ready to call the 'usb_gadget_udc_start()' and
>>>>> 'usb_udc_connect_control()', then if the dwc3 core has entered
>>>>> suspended mode, we need to return success when starting the gadget,
>>>>> and leave the gadget starting action from gadget resume. What do you
>>>>> think about that? Thanks.
>>>>
>>>> Well, if this makes it work properly. Then, yeah; looks okay to me. I'll
>>>> add this to the patch introducing runtime PM.
>>>
>>> OK.
>>
>> I've updated the branch with slightly modified version of your
>> changes. Can you test again just to make sure it still works ?
>>
>> Basically, here's what I did:
>>
>> on dwc3_gadget_start:
>>
>> -       __dwc3_gadget_start(dwc);
>> +       if (pm_runtime_active(dwc->dev))
>> +               __dwc3_gadget_start(dwc);
>> +
>
> Great.
>
>>
>> on run_stop, I kept the same thing.
>>
>> you just need to replace "usb: dwc3: implement runtime PM" with the new
>> version from my branch.
>
> Yeah, it can work well on my platform with your new patch.

cool, thanks again :-) I'll drop my "not for merging note" and add your
"Tested-by" (assuming it's okay for you that I do it).

cheers

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (819 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ