From ef03f13bd199959a88d3f38f4aede3bdb6e42fa4 Mon Sep 17 00:00:00 2001 From: Rahix <rahix@rahix.de> Date: Sat, 24 Aug 2019 09:11:27 +0200 Subject: [PATCH] fix(hw-locks): Don't show warnings for 0 wait acquires Signed-off-by: Rahix <rahix@rahix.de> --- epicardium/modules/hw-lock.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/epicardium/modules/hw-lock.c b/epicardium/modules/hw-lock.c index cc9986ec..ce88d921 100644 --- a/epicardium/modules/hw-lock.c +++ b/epicardium/modules/hw-lock.c @@ -28,9 +28,14 @@ int hwlock_acquire(enum hwlock_periph p, TickType_t wait) TaskHandle_t task = xTaskGetCurrentTaskHandle(); if (xSemaphoreTake(hwlock_mutex[p], wait) != pdTRUE) { + /* Don't print warnings for 0 wait acquires */ + if (wait == 0) { + return -EBUSY; + } + LOG_WARN( "hwlock", - "Lock %u is busy, held by: %s, attempt to accquire by: %s", + "Lock %u is busy! Held by \"%s\" and attempted to accquire by \"%s\"", p, pcTaskGetName(hwlock_tasks[p]), pcTaskGetName(task) -- GitLab