Skip to content

Conversation

@etienne-lms
Copy link
Contributor

Clean indentation in macros used to define STM32 driver instances resources. The main issue is a missing tabulation at the beginning of the each line participating to the macro value.

No functional changes.

A few other driver would deserve equivalent changes. I've proposed them in other P-Rs that already modify the related macros content for other purposes: stm32-clk-info P-R #98995, i2s P-R #98925.

@etienne-lms
Copy link
Contributor Author

SonarCloud error reports look like false positive, e.g.:
https://sonarcloud.io/project/issues?pullRequest=99085&open=AZpeyA1arbB9veztWwEP&id=zephyrproject-rtos_zephyr

Copy link
Contributor

@mathieuchopstm mathieuchopstm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise LGTM

Comment on lines 73 to 74
\
PINCTRL_DT_INST_DEFINE(inst); \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\
PINCTRL_DT_INST_DEFINE(inst); \
PINCTRL_DT_INST_DEFINE(inst); \

Unless there's a rationale for the empty line I missed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, I'm fine removing it.

Comment on lines 37 to 38
#define STM32_MUX_CLK_INIT(id) \
\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define STM32_MUX_CLK_INIT(id) \
\
#define STM32_MUX_CLK_INIT(id) \

Comment on lines 547 to 548
.n_timings = sizeof(i2c_timings_##index) / \
(sizeof(struct i2c_config_timing)),)) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the "stray" / makes this a bit harder to understand now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i'll restore the previous way.

\
static const struct stm32_pclken pclken_##index[] = \
STM32_DT_CLOCKS(PWM(index)); \
STM32_DT_CLOCKS(PWM(index)); \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: it would be better to always use tabs rather than end with spaces (general remark, as there's - alas! - no consistency across drivers...)

Suggested change
STM32_DT_CLOCKS(PWM(index)); \
STM32_DT_CLOCKS(PWM(index)); \

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I tend to preserve existing line when possible. That' said, I agree with you, I'll update the surrounding lines for consistency in this source file.

Comment on lines 73 to 74
\
PINCTRL_DT_INST_DEFINE(inst); \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, I'm fine removing it.

Comment on lines 547 to 548
.n_timings = sizeof(i2c_timings_##index) / \
(sizeof(struct i2c_config_timing)),)) \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i'll restore the previous way.

\
static const struct stm32_pclken pclken_##index[] = \
STM32_DT_CLOCKS(PWM(index)); \
STM32_DT_CLOCKS(PWM(index)); \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I tend to preserve existing line when possible. That' said, I agree with you, I'll update the surrounding lines for consistency in this source file.

{ \
COND_CODE_1(DT_IRQ_HAS_NAME(PWM(index), cc), \
(IRQ_CONNECT_AND_ENABLE_BY_NAME(index, cc)), \
(IRQ_CONNECT_AND_ENABLE_DEFAULT(index))); \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI i'll remove this trailing ;.

mathieuchopstm
mathieuchopstm previously approved these changes Nov 12, 2025
IF_ENABLED(DT_HAS_COMPAT_STATUS_OKAY(st_stm32_i2c_v2), \
(.timings = (const struct i2c_config_timing *)i2c_timings_##index, \
.n_timings = \
sizeof(i2c_timings_##index) / (sizeof(struct i2c_config_timing)),))\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
sizeof(i2c_timings_##index) / (sizeof(struct i2c_config_timing)),))\
sizeof(i2c_timings_##index) / (sizeof(struct i2c_config_timing)),)) \

Comment on lines 297 to 298
.n_timings = sizeof(i2c_timings_##index) / \
(sizeof(struct i2c_config_timing)),)) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed this one. Thanks.

Clean indentation in STM32_MCO_INIT() and STM32_MUX_CLK_INIT() macros.
Add after coma pclken field value in stm32_clk_mux_cfg_##id to ease
possible later changes.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Clean indentation in SDMMC_DMA_CHANNEL() macro and fix an extra line
escape at last line of SDMMC_DMA_CHANNEL_INIT() macro value.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Clean indentation in I2C_DMA_DATA_INIT() and I2C_STM32_INIT() macros.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Clean indentation in STM32_I3C_DMA_CHANNEL_INIT() and
STM32_I3C_DMA_CHANNEL() macros of STM32 I3C driver.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Clean indentation in IRQ_CONNECT_AND_ENABLE_BY_NAME(), IRQ_CONFIG_FUNC()
and IRQ_CONNECT_AND_ENABLE_DEFAULT() macros of STM32 PWM driver.
Remove a useless trailing semi column character in the interrupt function
defined with IRQ_CONFIG_FUNC() macro.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Clean indentation in local macros used to define UART instances.
Remove extra line escape ending CONFIG_UART_ASYNC_API() macro value.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Simplify interrupt handler helper macros by removing
STM32_UART_IRQ_HANDLER_DECL(), using STM32_UART_IRQ_HANDLER() only
renamed STM32_UART_IRQ_HANDLER_DEFINE() and aggregating where the
macro and STM32_UART_IRQ_HANDLER_FUNC() macro are defined.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Clean indentation in macros used to define instances in STM32
HSEM hardware semaphore drivers.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
@etienne-lms
Copy link
Contributor Author

Review comment addressed.
Rebased.

@sonarqubecloud
Copy link

Please retry analysis of this Pull-Request directly on SonarQube Cloud

@decsny decsny removed their request for review November 12, 2025 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Clock Control area: Disk Access area: I2C area: I3C area: IPM Inter-Processor Mailbox area: PWM Pulse Width Modulation area: UART Universal Asynchronous Receiver-Transmitter platform: STM32 ST Micro STM32

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants