Skip to content

Commit f715301

Browse files
maass-hamburgkartben
authored andcommitted
dts: enum_macros: make sure that they are lowercase
DT_ENUM_HAS_VALUE_BY_IDX states, that the value must be lowercase-and-underscores, this makes sure, that they can match. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
1 parent 979933c commit f715301

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

drivers/comparator/comparator_nrf_comp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
_CONCAT(COMP_NRF_COMP_REFSEL_, DT_INST_STRING_TOKEN(inst, refsel))
1818

1919
#define SHIM_NRF_COMP_DT_INST_REFSEL_IS_AREF(inst) \
20-
DT_INST_ENUM_HAS_VALUE(inst, refsel, AREF)
20+
DT_INST_ENUM_HAS_VALUE(inst, refsel, aref)
2121

2222
#define SHIM_NRF_COMP_DT_INST_EXTREFSEL(inst) \
2323
_CONCAT(COMP_NRF_COMP_EXTREFSEL_, DT_INST_STRING_TOKEN(inst, extrefsel))
2424

2525
#define SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_SE(inst) \
26-
DT_INST_ENUM_HAS_VALUE(inst, main_mode, SE)
26+
DT_INST_ENUM_HAS_VALUE(inst, main_mode, se)
2727

2828
#define SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_DIFF(inst) \
29-
DT_INST_ENUM_HAS_VALUE(inst, main_mode, DIFF)
29+
DT_INST_ENUM_HAS_VALUE(inst, main_mode, diff)
3030

3131
#define SHIM_NRF_COMP_DT_INST_TH_DOWN(inst) \
3232
DT_INST_PROP(inst, th_down)

drivers/comparator/comparator_nrf_lpcomp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
_CONCAT(COMP_NRF_LPCOMP_REFSEL_, DT_INST_STRING_TOKEN(inst, refsel))
2020

2121
#define SHIM_NRF_LPCOMP_DT_INST_REFSEL_IS_AREF(inst) \
22-
DT_INST_ENUM_HAS_VALUE(inst, refsel, AREF)
22+
DT_INST_ENUM_HAS_VALUE(inst, refsel, aref)
2323

2424
#define SHIM_NRF_LPCOMP_DT_INST_EXTREFSEL(inst) \
2525
_CONCAT(COMP_NRF_LPCOMP_EXTREFSEL_, DT_INST_STRING_TOKEN(inst, extrefsel))

scripts/dts/gen_defines.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,9 @@ def enum_macros(prop: edtlib.Property, macro: str):
679679
val = prop.val_as_tokens if spec.enum_tokenizable else (prop.val if isinstance(prop.val, list) else [prop.val])
680680

681681
for i, subval in enumerate(val):
682+
# make sure the subval is a formated right.
683+
if isinstance(subval, str):
684+
subval = str2ident(subval)
682685
# DT_N_<node-id>_P_<prop-id>_IDX_<i>_EXISTS
683686
ret[f"{macro}_IDX_{i}_EXISTS"] = 1
684687
# DT_N_<node-id>_P_<prop-id>_IDX_<i>_ENUM_VAL_<val>_EXISTS 1

0 commit comments

Comments
 (0)