diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2021-03-23 15:55:09 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-23 23:22:20 +0000 |
commit | 7b03f267438d6a495702032445843de17bcc08bd (patch) | |
tree | eacbc757ce0113b2b0cb7a5eac5e2fe5e3728889 /common/usbc | |
parent | c6de49ac683d0633f70ced7c0be508ba1353930f (diff) | |
download | chrome-ec-7b03f267438d6a495702032445843de17bcc08bd.tar.gz |
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 <jrosenth@chromium.org>
Change-Id: I4ffbde25f66bf33f33b4432e2c71871697d71023
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782236
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/usbc')
-rw-r--r-- | common/usbc/usb_pd_dpm.c | 13 |
1 files changed, 1 insertions, 12 deletions
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 */ |