drivers: clock_control: gd32: Correcting timer node detection

DT_COMPAT_GET_ANY_STATUS_OKAY is not suited for the node's existing check.
(This macro returns the stem of the DTS macro name,
 the stem part is not a defined symbol.)
Instead, it should use the DT_HAS_COMPAT_STATUS_OKAY macro.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
This commit is contained in:
TOKITA Hiroshi 2022-11-03 16:20:38 +09:00 committed by Carles Cufí
parent edc115b1b7
commit 79451c221a

View file

@ -38,7 +38,7 @@ struct clock_control_gd32_config {
uint32_t base;
};
#if DT_COMPAT_GET_ANY_STATUS_OKAY(gd_gd32_timer)
#if DT_HAS_COMPAT_STATUS_OKAY(gd_gd32_timer)
/* timer identifiers */
#define TIMER_ID_OR_NONE(nodelabel) \
COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(nodelabel), okay), \
@ -65,7 +65,7 @@ static const uint8_t timer_ids[] = {
TIMER_ID_OR_NONE(timer15) /* */
TIMER_ID_OR_NONE(timer16) /* */
};
#endif /* DT_COMPAT_GET_ANY_STATUS_OKAY(gd_gd32_timer) */
#endif /* DT_HAS_COMPAT_STATUS_OKAY(gd_gd32_timer) */
static int clock_control_gd32_on(const struct device *dev,
clock_control_subsys_t sys)
@ -128,7 +128,7 @@ static int clock_control_gd32_get_rate(const struct device *dev,
return -ENOTSUP;
}
#if DT_COMPAT_GET_ANY_STATUS_OKAY(gd_gd32_timer)
#if DT_HAS_COMPAT_STATUS_OKAY(gd_gd32_timer)
/* handle timer clocks */
for (size_t i = 0U; i < ARRAY_SIZE(timer_ids); i++) {
if (GD32_CLOCK_ID_BIT(id) != timer_ids[i]) {
@ -176,7 +176,7 @@ static int clock_control_gd32_get_rate(const struct device *dev,
}
#endif /* CONFIG_SOC_SERIES_GD32F4XX */
}
#endif /* DT_COMPAT_GET_ANY_STATUS_OKAY(gd_gd32_timer) */
#endif /* DT_HAS_COMPAT_STATUS_OKAY(gd_gd32_timer) */
return 0;
}