Skip to content

Commit

Permalink
drivers/pinctrl.h: Resolve PINCTRL_DT_STATE_INIT Cpp Compatibility
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
AirChandler authored and mmahadevan108 committed Sep 28, 2024
1 parent 7aef84c commit a9be210
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/zephyr/drivers/pinctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,9 @@ static inline int pinctrl_apply_state(const struct pinctrl_dev_config *config,
*/
#define PINCTRL_DT_STATE_INIT(prop, state) \
{ \
.id = state, \
.pins = prop ## _pins, \
.pin_cnt = ARRAY_SIZE(prop ## _pins) \
.pin_cnt = ARRAY_SIZE(prop ## _pins), \
.id = state \
}

/**
Expand Down

0 comments on commit a9be210

Please sign in to comment.