Skip to content

drivers: spi: fix the update of spi_context tx & rx length #90796

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

Merged
merged 1 commit into from
Jun 4, 2025

Conversation

cyliangtw
Copy link
Collaborator

This PR is to fix spi_context.h .
The unit of spi_context's tx_len and rx_len is byte instead of frame.
The value of ctx->tx_len should be reduced by (len * dfs).

The unit of spi_context's tx_len and rx_len is byte instead of frame.
Thus, in spi_context_update_tx(), the value of ctx->tx_len should be
reduced by (len * dfs).
Also to fix the update of ctx->tx_len in spi_context_update_rx().

Signed-off-by: cyliang tw <[email protected]>
Copy link

@cyliangtw cyliangtw requested a review from fabiobaltieri May 29, 2025 11:09
@teburd
Copy link
Collaborator

teburd commented May 29, 2025

It would be great to see test coverage of this sort of thing

@cyliangtw cyliangtw requested a review from kartben June 2, 2025 08:15
@dkalowsk dkalowsk merged commit 4a486ce into zephyrproject-rtos:main Jun 4, 2025
27 checks passed
@decsny
Copy link
Member

decsny commented Jun 4, 2025

this PR should have been raised to awareness of more people, I had no idea about it and although the change looks small and sounds right, it has seriously huge implications, see #91075 . Maybe the change is correct, I'll need to check, at first glance it seems correct , but I seriously doubt that this doesn't have huge effects on every spi driver that uses the spi context . All the drivers should have been updated to reflect this change in behavior to the shared code

@decsny
Copy link
Member

decsny commented Jun 4, 2025

I tried to give the PR the benefit of the doubt, but now I looked through closely the spi_context file and debugged the new behavior and can say now that I have no idea how this PR even got submitted, let alone approved and merged, it's totally incorrect

@kartben
Copy link
Collaborator

kartben commented Jun 4, 2025

I tried to give the PR the benefit of the doubt, but now I looked through closely the spi_context file and debugged the new behavior and can say now that I have no idea how this PR even got submitted, let alone approved and merged, it's totally incorrect

Can you or someone else please send a revert if it's that badly broken? Thanks!

@decsny
Copy link
Member

decsny commented Jun 4, 2025

@kartben I have it at #91079

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: SPI SPI bus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants