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/gpio: specify whether driver is ISR-safe #17827

Closed
wants to merge 1 commit into from

Conversation

pabigot
Copy link
Collaborator

@pabigot pabigot commented Jul 28, 2019

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.

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().

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
@pabigot pabigot added the dev-review To be discussed in dev-review meeting label Jul 31, 2019
@pabigot
Copy link
Collaborator Author

pabigot commented Jul 31, 2019

Added to dev review to get feedback on whether this should be generalized to additional devices, e.g. counter.

@galak
Copy link
Collaborator

galak commented Aug 1, 2019

Referencing #6184

@galak galak removed the dev-review To be discussed in dev-review meeting label Aug 1, 2019
@pabigot
Copy link
Collaborator Author

pabigot commented Aug 1, 2019

DEV-REVIEW: Consensus was that this needs to be solved globally to cover #1960, #3694, #6184, and #17014, rather than add a new API that handles it for only one type of driver-specific limitation within one driver class.

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.

3 participants