drivers/gpio: specify whether driver is ISR-safe #17827
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At least one GPIO driver (SX1509B) is outside the SOC and requires I2C transactions for its basic operations. That fact could not be detected from a generic GPIO driver reference, potentially causing problems if a pin was written or reconfigured from within an ISR.
Add a flag to the driver API that specifies that ISR operations are unsafe, and set the flag in the SX1509B driver API structure. Add API that allows querying the state of this flag, to be used in concert with
k_is_in_isr()
.NOTE GPIOs are only one type of driver where this capability is needed. It should also be supported in
counter
to avoid misuse of the counter implementation in #17631.