aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2024-10-23 19:51:02 -0400
committerKevin O'Connor <kevin@koconnor.net>2024-10-26 22:11:02 -0400
commitb381f509d11f022022536f41343fcc868484a396 (patch)
treeba123cdfdb76cf3bb770280a9d81240472a6ba5f /src
parentea546c789b4d1278078187b386ba85f324267892 (diff)
downloadkutter-b381f509d11f022022536f41343fcc868484a396.tar.gz
kutter-b381f509d11f022022536f41343fcc868484a396.tar.xz
kutter-b381f509d11f022022536f41343fcc868484a396.zip
trsync: Don't require callers of trsync_do_trigger() to disable irqs
Disable irqs within trsync_do_trigger(). This fixes a bug in ldc1612 - as that code was calling trsync_do_trigger() without first disabling irqs. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r--src/trsync.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/trsync.c b/src/trsync.c
index 3bf7aa66..5625280a 100644
--- a/src/trsync.c
+++ b/src/trsync.c
@@ -1,6 +1,6 @@
// Handling of synchronized "trigger" dispatch
//
-// Copyright (C) 2016-2021 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2016-2024 Kevin O'Connor <kevin@koconnor.net>
//
// This file may be distributed under the terms of the GNU GPLv3 license.
@@ -23,13 +23,14 @@ enum { TSF_CAN_TRIGGER=1<<0, TSF_REPORT=1<<2 };
static struct task_wake trsync_wake;
-// Activate a trigger (caller must disable IRQs)
+// Activate a trigger
void
trsync_do_trigger(struct trsync *ts, uint8_t reason)
{
+ irqstatus_t flag = irq_save();
uint8_t flags = ts->flags;
if (!(flags & TSF_CAN_TRIGGER))
- return;
+ goto done;
ts->trigger_reason = reason;
ts->flags = (flags & ~TSF_CAN_TRIGGER) | TSF_REPORT;
// Dispatch signals
@@ -42,6 +43,8 @@ trsync_do_trigger(struct trsync *ts, uint8_t reason)
func(tss, reason);
}
sched_wake_task(&trsync_wake);
+done:
+ irq_restore(flag);
}
// Timeout handler