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

Patrice Chotard patrice.chotard at foss.st.com
Thu Jun 25 10:38:13 CEST 2026


On STM32MP157C-DK2, when aborting the command "ums" using CTRL-C
it may take a while to get the control back on the console,
sometimes around 1 second.

By moving schedule() in order to call it only every 10 loop iteration
it increases the CTRL+C reactivity.

Signed-off-by: Patrice Chotard <patrice.chotard at foss.st.com>
---
Changes in v2:
- Update commit message with more details.
- Link to v1: https://patch.msgid.link/20260622-move_schedule-v1-1-4b5dac252b70@foss.st.com

To: u-boot at lists.denx.de
Cc: Lukasz Majewski <lukma at denx.de>
Cc: Mattijs Korpershoek <mkorpershoek at kernel.org>
Cc: Marek Vasut <marex at denx.de>
Cc: Tom Rini <trini at konsulko.com>
Cc: Patrice Chotard <patrice.chotard at foss.st.com>
---
 drivers/usb/gadget/f_mass_storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 71dc58da3f0..fb0803e856f 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -676,10 +676,10 @@ static int sleep_thread(struct fsg_common *common)
 			if (!g_dnl_board_usb_cable_connected())
 				return -EIO;
 
+			schedule();
 			k = 0;
 		}
 
-		schedule();
 		dm_usb_gadget_handle_interrupts(udcdev);
 	}
 	common->thread_wakeup_needed = 0;

---
base-commit: 1296a428c67cf103eca482d4a63349661c1b799f
change-id: 20260622-move_schedule-1f94c93e10cd

Best regards,
--  
Patrice Chotard <patrice.chotard at foss.st.com>



More information about the U-Boot mailing list