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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 31 May 2018 10:23:57 +0300
From:   Roger Quadros <rogerq@...com>
To:     Felipe Balbi <balbi@...nel.org>, Tero Kristo <t-kristo@...com>,
        "Gerlach, Dave" <d-gerlach@...com>
CC:     <linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Nishanth Menon <nm@...com>, "Nori, Sekhar" <nsekhar@...com>
Subject: Re: [PATCH 2/2] usb: dwc3: of_simple: don't call
 pm_runtime_set_active()


On 30/05/18 15:31, Felipe Balbi wrote:
> Roger Quadros <rogerq@...com> writes:
> 
>> Don't call pm_runtime_set_active() as it will prevent the device
>> from being activated in the next pm_runtime_get_sync() call.
>>
>> Also call pm_runtime_get_sync() before of_platform_populate().
>>
>> Signed-off-by: Roger Quadros <rogerq@...com>
> 
> This patch is wrong.
> 
>> ---
>>  drivers/usb/dwc3/dwc3-of-simple.c | 7 +++----
>>  1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
>> index e98d221..2cbb5c0 100644
>> --- a/drivers/usb/dwc3/dwc3-of-simple.c
>> +++ b/drivers/usb/dwc3/dwc3-of-simple.c
>> @@ -121,6 +121,9 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
>>  	if (ret)
>>  		goto err_resetc_assert;
>>  
>> +	pm_runtime_enable(dev);
>> +	pm_runtime_get_sync(dev);
> 
> No, this is the wrong way to do things. My device should be enabled
> already from probe, specially since I have already enabled clocks.

As far as I understood just enabling clocks (which might not include bus clock)
doesn't ensure device is enabled.

Did you mean that I don't need to do a pm_runtime_get_sync() to enable my device in probe?
Who is enabling by device for me then? Is device core supposed to do it?

> 
>>  	ret = of_platform_populate(np, NULL, NULL, dev);
>>  	if (ret) {
>>  		for (i = 0; i < simple->num_clocks; i++) {
>> @@ -131,10 +134,6 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
>>  		goto err_resetc_assert;
>>  	}
>>  
>> -	pm_runtime_set_active(dev);
>> -	pm_runtime_enable(dev);
>> -	pm_runtime_get_sync(dev);
> 
> this hunk is not wrong at all.
> 

The issue I was facing is that without this patch my device wasn't being enabled
as pm_runtime_set_active() is being done _before_ pm_runtime_get_sync().
It could be an issue with the platform's PM domain code as well.

Tero/Dave what do you think?

-- 
cheers,
-roger

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ