Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: i2c: xilinx_axi: Remove nested spinlock #84016

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

neeliajay
Copy link

Removed nested spinlock acquisition in i2c_xilinx_axi_write to prevent ztest failures due to invalid spinlock usage.
Ensured spinlocks are not consecutively acquired without unlocking, preventing potential deadlocks.

@zephyrbot zephyrbot added area: I2C size: XS A PR changing only a single line of code platform: Xilinx Xilinx labels Jan 15, 2025
Copy link

Hello @neeliajay, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

kartben
kartben previously approved these changes Jan 24, 2025
k_spin_unlock(&data->lock, key);
i2c_xilinx_axi_clear_interrupt(config, data, ISR_TX_FIFO_EMPTY | ISR_BUS_NOT_BUSY);
Copy link
Contributor

Choose a reason for hiding this comment

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

This introduces a window where the lock is released and then acquired again inside i2c_xilinx_axi_clear_interrupt, I'm not sure if that could cause some issues? Might be better to extract the portion of i2c_xilinx_axi_clear_interrupt which runs with the lock already acquired into a separate function, and then call that here before releasing the lock.

Copy link
Author

Choose a reason for hiding this comment

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

sure.. added separate function i2c_xilinx_axi_clear_interrupt_no_lock

Removed nested spinlock acquisition in i2c_xilinx_axi_write to prevent
ztest failures due to invalid spinlock usage.
Ensured spinlocks are not consecutively acquired without unlocking,
preventing potential deadlocks.

Signed-off-by: Ajay Neeli <[email protected]>
@neeliajay neeliajay force-pushed the i2c-xilinx-axi-remove-nested-spinlock branch from c84ffcb to f713b84 Compare February 27, 2025 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: I2C platform: Xilinx Xilinx size: XS A PR changing only a single line of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants