aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2025-02-06 18:19:54 -0500
committerKevin O'Connor <kevin@koconnor.net>2025-02-27 13:24:19 -0500
commit581c954f4076294e8f568f55f2196bd982e0b12a (patch)
treedd5f3644bd46548ddbee53e36861b88d15e81df3
parent98068beca0a3bbe8594f309d2fa6152b71baac49 (diff)
downloadkutter-581c954f4076294e8f568f55f2196bd982e0b12a.tar.gz
kutter-581c954f4076294e8f568f55f2196bd982e0b12a.tar.xz
kutter-581c954f4076294e8f568f55f2196bd982e0b12a.zip
usb_canbus: Wake usbcan_task when sending from canbus_send
Don't limit the canbus_notify_tx() wakeup to cases where notify_local is set - perform the wakeup whenever the host_status field indicates the main task has work pending. This fixes a small race condition where the main task could block sending a usb echo frame, and the canbus_send() code gets called as the usb bandwidth becomes available but before a usb wakeup notification is sent. In that situation, the usb code may not issue a wake event and the echo frames may be delayed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/generic/usb_canbus.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/generic/usb_canbus.c b/src/generic/usb_canbus.c
index 25d41c1b..9e17c105 100644
--- a/src/generic/usb_canbus.c
+++ b/src/generic/usb_canbus.c
@@ -335,7 +335,7 @@ canbus_send(struct canbus_msg *msg)
int ret = send_frame(msg);
if (ret < 0)
goto retry_later;
- if (UsbCan.notify_local && UsbCan.host_status)
+ if (UsbCan.host_status)
canbus_notify_tx();
UsbCan.notify_local = 0;
return msg->dlc;