From ba61af3b8c8a1f04caba91c4a264c78c1fe7d77b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Barna=C5=9B?= Date: Wed, 22 Sep 2021 18:19:29 +0200 Subject: zephyr: fix support for multiple fans MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes macros used to create named-fans instances. It will enable to have multiple named-fans declared in devicetree without raising "multiple definitions" error during compilation. BRANCH=main BUG=none TEST=Add named-fans instance in device tree and build firmware. Compilation with 2 or more names-fans should work correctly. Change-Id: If5c9a74f743749efc3a2872b0ced98500e96ca52 Signed-off-by: Michał Barnaś Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3176200 Reviewed-by: Keith Short Commit-Queue: Keith Short --- zephyr/shim/src/fan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zephyr/shim/src/fan.c b/zephyr/shim/src/fan.c index b6fa7b999a..932688fc9c 100644 --- a/zephyr/shim/src/fan.c +++ b/zephyr/shim/src/fan.c @@ -18,7 +18,7 @@ LOG_MODULE_REGISTER(fan_shim, LOG_LEVEL_ERR); #define FAN_CONFIGS(node_id) \ - const struct fan_conf node_id_conf = { \ + const struct fan_conf node_id##_conf = { \ .flags = (COND_CODE_1(DT_PROP(node_id, not_use_rpm_mode), \ (0), (FAN_USE_RPM_MODE))) | \ (COND_CODE_1(DT_PROP(node_id, use_fast_start), \ @@ -33,7 +33,7 @@ LOG_MODULE_REGISTER(fan_shim, LOG_LEVEL_ERR); (GPIO_SIGNAL(DT_PHANDLE(node_id, enable_gpio))), \ (GPIO_UNIMPLEMENTED)), \ }; \ - const struct fan_rpm node_id_rpm = { \ + const struct fan_rpm node_id##_rpm = { \ .rpm_min = DT_PROP(node_id, rpm_min), \ .rpm_start = DT_PROP(node_id, rpm_start), \ .rpm_max = DT_PROP(node_id, rpm_max), \ @@ -41,8 +41,8 @@ LOG_MODULE_REGISTER(fan_shim, LOG_LEVEL_ERR); #define FAN_INST(node_id) \ [node_id] = { \ - .conf = &node_id_conf, \ - .rpm = &node_id_rpm, \ + .conf = &node_id##_conf, \ + .rpm = &node_id##_rpm, \ }, #define FAN_CONTROL_INST(node_id) \ -- cgit v1.2.1