Skip to content

Conversation

@dpw13
Copy link
Contributor

@dpw13 dpw13 commented Nov 13, 2024

If CONFIG_I2C_STATS is enabled, the device state for all I2C controller drivers must contain the I2C stats. This space is allocated by calling Z_I2C_INIT_FN as part of the device definition; this is done automatically when using I2C_DEVICE_DT_DEFINE instead of DEVICE_DT_DEFINE. If space for statistics is not properly allocated but CONFIG_I2C_STATS is enabled, an unexpected write to memory outside of the stats region may occur on an I2C transfer. This commit uses I2C_DEVICE_DT_DEFINE or I2C_DEVICE_DT_INST_DEFINE for all in-tree I2C controller drivers that do not already.

teburd
teburd previously approved these changes Nov 13, 2024
@jilaypandya
Copy link
Member

Can you squash the second commit into first commit.

If CONFIG_I2C_STATS is enabled, the device state for all I2C controller
drivers must contain the I2C stats. This space is allocated by calling
Z_I2C_INIT_FN as part of the device definition; this is done automatically
when using I2C_DEVICE_DT_DEFINE instead of DEVICE_DT_DEFINE. If space
for statistics is not properly allocated but CONFIG_I2C_STATS is enabled,
an unexpected write to memory outside of the stats region may occur on
an I2C transfer. This commit uses I2C_DEVICE_DT_DEFINE or
I2C_DEVICE_DT_INST_DEFINE for all in-tree SPI controller drivers that do
not already.

Signed-off-by: Dane Wagner <[email protected]>
@dpw13 dpw13 force-pushed the dwagner/i2c-stats-fixup branch from fb262cc to 1b00b86 Compare November 14, 2024 23:00
@dpw13 dpw13 requested a review from teburd November 15, 2024 16:23
@nashif nashif merged commit 2f3a70e into zephyrproject-rtos:main Nov 19, 2024
23 checks passed
@github-actions
Copy link

Hi @dpw13!
Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a fantastic achievement, and we're thrilled to have you as part of our community!

To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge.

Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants