-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Swap the initialization order of ’spi_cs_control‘ members #97756
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
Swap the initialization order of ’spi_cs_control‘ members #97756
Conversation
7cb0cf0
to
17e5fd6
Compare
Putting cs_is_gpio last was suggested here #97366 (comment), following this PR #97292. Cc @decsny |
Cc @jeremydick |
the root cause here is that SPI_CS_CONTROL_INIT_GPIO and SPI_CS_CONTROL_INIT_NATIVE macros only initialize the union members, and cs_is_gpio must be initialized regardless of which union member is being used, Declan's former code does not have the cs_is_gpio used in SPI_CS_CONTROL_INIT_NATIVE, so it works. @decsny |
When using the macro 'SPI_CS_CONTROL_INIT_GPIO' to initialize the 'spi_cs_control' member, it is missing ',' after '.delay' leading to a compilation error. We can place the initialization of the 'cs_is_gpio' member at the very beginning. This way, whether initialized via 'SPI_CS_CONTROL_INIT_GPIO' or 'SPI_CS_CONTROL_INIT_NATIVE', there will be no compilation issues. Signed-off-by: Zhaoxiang Jin <[email protected]>
17e5fd6
to
23b73e0
Compare
|
i think if this PR merge that I already put then it would solve the problem, but nobody is reviewing/merging it even though its a hotfix: #97292 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this PR is not right, it doesnt respect anonymous initialization order of the struct, which can cause error based on compiler, according to user report using clang
Let's close this PR and move to yours |
Fixes #97581, since the issue block some PRs which target v4.3 release, so, i set 'hotfix' tag to this PR, if anyone thinks it's inappropriate, feel free to remove it.