From 7b03f267438d6a495702032445843de17bcc08bd Mon Sep 17 00:00:00 2001 From: Jack Rosenthal Date: Tue, 23 Mar 2021 15:55:09 -0600 Subject: usbc: change max_current_claimed_lock to use K_MUTEX_DEFINE Convert max_current_claimed_lock to use K_MUTEX_DEFINE(), removing the requirement for runtime initialization on Zephyr. BUG=b:177677037 BRANCH=none TEST=zmake testall && make buildall Signed-off-by: Jack Rosenthal Change-Id: I4ffbde25f66bf33f33b4432e2c71871697d71023 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782236 Reviewed-by: Simon Glass --- common/usbc/usb_pd_dpm.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'common') diff --git a/common/usbc/usb_pd_dpm.c b/common/usbc/usb_pd_dpm.c index 6b5243136f..d541603568 100644 --- a/common/usbc/usb_pd_dpm.c +++ b/common/usbc/usb_pd_dpm.c @@ -429,11 +429,7 @@ void dpm_run(int port) * them */ static uint32_t max_current_claimed; -static mutex_t max_current_claimed_lock; - -#ifdef CONFIG_ZEPHYR -static bool dpm_mutex_initialized; -#endif +K_MUTEX_DEFINE(max_current_claimed_lock); /* Ports with PD sink needing > 1.5 A */ static uint32_t sink_max_pdo_requested; @@ -477,13 +473,6 @@ static void balance_source_ports(void) if (deferred_waiting) return; -#ifdef CONFIG_ZEPHYR - if (!dpm_mutex_initialized) { - (void)k_mutex_init(&max_current_claimed_lock); - dpm_mutex_initialized = true; - } -#endif - mutex_lock(&max_current_claimed_lock); /* Remove any ports which no longer require 3.0 A */ -- cgit v1.2.1