From 2ba90135233c19f20aa6227ba37f3a686dd2a77c Mon Sep 17 00:00:00 2001
From: schneider <schneider@blinkenlichts.net>
Date: Tue, 28 Apr 2020 20:29:51 +0200
Subject: [PATCH] refact(gpio): Use new style HW locks

---
 epicardium/modules/gpio.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/epicardium/modules/gpio.c b/epicardium/modules/gpio.c
index 872aaee7a..72ce3ba6a 100644
--- a/epicardium/modules/gpio.c
+++ b/epicardium/modules/gpio.c
@@ -137,18 +137,15 @@ int epic_gpio_read_pin(uint8_t pin)
 	} else if (cfg->func == GPIO_FUNC_IN) {
 		return GPIO_InGet(cfg) != 0;
 	} else if (cfg->func == GPIO_FUNC_ALT1) {
-		int rc = hwlock_acquire_timeout(HWLOCK_ADC, portMAX_DELAY);
-		if (!rc) {
-			ADC_StartConvert(s_adc_channels[pin], 0, 0);
-			uint16_t value;
-			int rc = ADC_GetData(&value);
-			hwlock_release(HWLOCK_ADC);
-			if (rc < 0) {
-				return -EIO;
-			}
-			return (int)value;
+		hwlock_acquire(HWLOCK_ADC);
+		ADC_StartConvert(s_adc_channels[pin], 0, 0);
+		uint16_t value;
+		int rc = ADC_GetData(&value);
+		hwlock_release(HWLOCK_ADC);
+		if (rc < 0) {
+			return -EIO;
 		}
-		return rc;
+		return (int)value;
 	} else {
 		return -EINVAL;
 	}
-- 
GitLab