Skip to content

Commit a9be210

Browse files
AirChandlermmahadevan108
authored andcommitted
drivers/pinctrl.h: Resolve PINCTRL_DT_STATE_INIT Cpp Compatibility
This commit adds C++20 onwards support for the PINCTRL_DT_STATE_INIT macro. Since C++20, support was added for designated initializers but with the restriction that they're ordered. PINCTRL_DT_STATE_INIT initializes a pinctrl_state struct but the current initializer list is un-ordered, this PR resolves that for >= C++20 compat Signed-off-by: Chandler Keep <[email protected]>
1 parent 7aef84c commit a9be210

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/zephyr/drivers/pinctrl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,9 @@ static inline int pinctrl_apply_state(const struct pinctrl_dev_config *config,
414414
*/
415415
#define PINCTRL_DT_STATE_INIT(prop, state) \
416416
{ \
417-
.id = state, \
418417
.pins = prop ## _pins, \
419-
.pin_cnt = ARRAY_SIZE(prop ## _pins) \
418+
.pin_cnt = ARRAY_SIZE(prop ## _pins), \
419+
.id = state \
420420
}
421421

422422
/**

0 commit comments

Comments
 (0)