Re: [PATCH] usb: dwc3: Fix debugfs creation flow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jack,

On 6/17/2021 10:31 AM, Jack Pham wrote:
> Hi Minas,
> 
> On Wed, Jun 16, 2021 at 10:56:02PM -0700, Minas Harutyunyan wrote:
>> Creation EP's debugfs called earlier than debugfs folder for dwc3
>> device created. As result EP's debugfs are created in '/sys/kernel/debug'
>> instead of '/sys/kernel/debug/usb/dwc3.1.auto'.
> 
> Interesting, I didn't encounter this in my testing. Oh but in our case
> we have dr_mode as USB_DR_MODE_OTG, so when dwc3_core_init_mode() calls
> dwc3_drd_init() the gadget_init() is done from a worker, and meanwhile
> dwc3_debugfs_init() would have already had a chance to create the root
> folder before that.
> 
> I'm assuming you're seeing this with dr_mode == USB_DR_MODE_PERIPHERAL?
> Then in that case dwc3_core_init_mode() synchronously calls
> dwc3_gadget_init() before the debugfs_init.

In my case dr_mode forced to gadget.

> 
>> Moved dwc3_debugfs_init() function call before calling
>> dwc3_core_init_mode() to allow create dwc3 debugfs parent before
>> creating EP's debugfs's.
>>
>> Fixes: 8562d5bfc0fc ("USB: dwc3: remove debugfs root dentry storage")
> 
> Isn't it fixing 8d396bb0a5b6 ("usb: dwc3: debugfs: Add and remove
> endpoint dirs dynamically")?  More fallout from my change I guess :-/.
> 

Issue happen because of instead of 'dwc->root' uses debugfs_lookup() 
function on debugfs's creation. This is why I think my "Fixes:" tag is 
correct.

Thanks,
Minas


> Anyway it looks good to me, thanks!
> 
> Reviewed-by: Jack Pham <jackp@xxxxxxxxxxxxxx>
> 
>> Signed-off-by: Minas Harutyunyan <hminas@xxxxxxxxxxxx>
>> ---
>>   drivers/usb/dwc3/core.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>> index e0a8e796c158..ba74ad7f6995 100644
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -1620,17 +1620,18 @@ static int dwc3_probe(struct platform_device *pdev)
>>   	}
>>   
>>   	dwc3_check_params(dwc);
>> +	dwc3_debugfs_init(dwc);
>>   
>>   	ret = dwc3_core_init_mode(dwc);
>>   	if (ret)
>>   		goto err5;
>>   
>> -	dwc3_debugfs_init(dwc);
>>   	pm_runtime_put(dev);
>>   
>>   	return 0;
>>   
>>   err5:
>> +	dwc3_debugfs_exit(dwc);
>>   	dwc3_event_buffers_cleanup(dwc);
>>   
>>   	usb_phy_shutdown(dwc->usb2_phy);
>>
>> base-commit: 1da8116eb0c5dfc05cfb89896239badb18c4daf3
>> -- 
>> 2.11.0
>>





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux