From 2a4cf1b7da2f3100e4b33e2c4640d10b77bd2d29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Tue, 2 Dec 2025 08:16:11 +0100 Subject: [PATCH] [nrf fromlist] soc: nordic: nrf_sys_event: handle errors correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nrfx_power_constlat API returns negative value if the requested action has no effect, which is expected in cases of multiple requests/releases. Align nrf_sys_event to not treat it as an error. Upstream PR #: 100342 Signed-off-by: MichaƂ Stasiak (cherry picked from commit 796b28fa4b098a276322b31eca3516fc190af37a) --- soc/nordic/common/nrf_sys_event.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/soc/nordic/common/nrf_sys_event.c b/soc/nordic/common/nrf_sys_event.c index 76664fe5f245..972487c528d9 100644 --- a/soc/nordic/common/nrf_sys_event.c +++ b/soc/nordic/common/nrf_sys_event.c @@ -76,12 +76,20 @@ int nrf_sys_event_release_global_constlat(void) int nrf_sys_event_request_global_constlat(void) { - return nrfx_power_constlat_mode_request(); + int err; + + err = nrfx_power_constlat_mode_request(); + + return (err == 0 || err == -EALREADY) ? 0 : -EAGAIN; } int nrf_sys_event_release_global_constlat(void) { - return nrfx_power_constlat_mode_free(); + int err; + + err = nrfx_power_constlat_mode_free(); + + return (err == 0 || err == -EBUSY) ? 0 : -EAGAIN; } #endif