From e849d37cefbb22619c325bc6bec9853901952bb7 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Wed, 21 Feb 2024 00:25:26 +0000 Subject: [PATCH] pm: use braces for .pm_base inside anonymous union initializer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes commit 25173f71cda6 ("pm: device_runtime: Extend with synchronous runtime PM") Fixes compilation with gcc 4.2-based toolchain used by SOF for TGL generation products. As seen in the error message below, that gcc version requires braces for initialization of anonymous unions: ``` zephyr/soc/xtensa/intel_adsp/common/mem_window.c:62: error: unknown field ‘pm_base’ specified in initializer warning: missing braces around initializer warning: (near initialization for ‘__device_dts_ord_66.’) ``` This is a well-known and recurring issue, see past example(s) in #68118 As the Zephyr build is deterministic, I could easily verify that this commit makes zero .obj difference (when using the Zephyr SDK). Signed-off-by: Marc Herbert --- include/zephyr/device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/device.h b/include/zephyr/device.h index e581fe74d38385..00d1c1552f9c0e 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h @@ -906,7 +906,7 @@ static inline bool z_impl_device_is_ready(const struct device *dev) .state = (state_), \ .data = (data_), \ IF_ENABLED(CONFIG_DEVICE_DEPS, (.deps = (deps_),)) /**/ \ - IF_ENABLED(CONFIG_PM_DEVICE, (.pm_base = (pm_),)) /**/ \ + IF_ENABLED(CONFIG_PM_DEVICE, ({ .pm_base = (pm_),)}) /**/ \ } /**