-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[TOPIC-GPIO] proposed workaround to distinguish interrupt disable from default no-change #19553
Conversation
All checks are passing now. checkpatch (informational only, not a failure)
Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
40e7a83
to
c5fa5e2
Compare
27ed348
to
bceed5d
Compare
This is a well prepared PR, it does solve the problem with interrupt handling that we have. My only concern is that the approach is not quite clean. It's applicable as a temporary workaround but not as a long term solution. In the drivers one can find code like this one:
Which will be confusing to any new user reading the code. It's because part of the states encoded by I would like to propose another approach that doesn't require adding
This way we keep the original behavior. |
gpio_pin_interrupt_configure() verified that the pin was within range, while gpio_pin_configure() did not. Make them consistent since they take the same set of flags. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
6f80df5
to
814da32
Compare
Had this PR been addressed promptly we might not have a bunch of drivers that can't distinguish between interrupt disable and no-change states. I've made the change as requested. |
gpio_pin_interrupt_configure() is invoked from within gpio_pin_configure() to support legacy code that combines pin and interrupt configuration. Expressing a disabled interrupt by a zero value for interrupt flags causes this invocation to disable interrupts when the intent is to change only a pin configuration, such as pull direction. Support a distinction between explicitly disabling interrupts and leaving the interrupt configuration unchanged. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Fixes #19552.