[PATCH] usb: gadget: f_mass_storage: Add schedule() in sleep_thread()

Patrice CHOTARD patrice.chotard at foss.st.com
Mon Dec 2 08:28:48 CET 2024



On 11/29/24 18:35, Marek Vasut wrote:
> On 11/29/24 1:46 PM, Patrice Chotard wrote:
>> In case "ums" command is used on platforms which don't implement
>> g_dnl_board_usb_cable_connected() and USB cable is not connected,
>> we stay inside sleep_thread() forever and watchdog is triggered.
>>
>> Add schedule() call to avoid this issue.
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard at foss.st.com>
>> ---
>>
>>   drivers/usb/gadget/f_mass_storage.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
>> index ffe1ae6eb73..6dc73ef447b 100644
>> --- a/drivers/usb/gadget/f_mass_storage.c
>> +++ b/drivers/usb/gadget/f_mass_storage.c
>> @@ -680,6 +680,7 @@ static int sleep_thread(struct fsg_common *common)
>>                   return -EIO;
>>                 k = 0;
>> +            schedule();
>>           }
>>             dm_usb_gadget_handle_interrupts(udcdev);
> 
> Shouldn't that schedule() be placed right before/after dm_usb_gadget_handle_interrupts() ?

Hi Marek

Yes schedule() can be put before/after dm_usb_gadget_handle_interrupts().
I will send a v2.

Patrice



More information about the U-Boot mailing list