-
Notifications
You must be signed in to change notification settings - Fork 2.1k
periph/gpio: use inline functions to test for valid and equal GPIOs #14902
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
periph/gpio: use inline functions to test for valid and equal GPIOs #14902
Conversation
The expandable GPIO API requires the comparison of structured GPIO types. This means that inline functions must be used instead of direct comparisons. For the migration process, drivers and other modules must first be changed so that they use the inline comparison functions.
The expandable GPIO API requires the comparison of structured GPIO types. This means that inline functions must be used instead of direct comparisons. For the migration process, drivers must first be changed so that they use the inline comparison functions.
The expandable GPIO API requires the comparison of structured GPIO types. This means that inline functions must be used instead of direct comparisons. For the migration process, tests must first be changed so that they use the inline comparison functions.
The expandable GPIO API requires the comparison of structured GPIO types. This means that inline functions must be used instead of direct comparisons. For the migration process, packages must first be changed so that they use the inline comparison functions.
if ((cs == SPI_CS_UNDEF) || (cs == GPIO_UNDEF)) { | ||
if (gpio_is_equal(cs, SPI_CS_UNDEF) || !gpio_is_valid(cs)) { |
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 understand that you want to keep this PR simple, basically just doing automatic conversion.
But mind you that SPI_CS_UNDEF
is
#define SPI_CS_UNDEF (GPIO_UNDEF)
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.
SPI_CS_UNDEF
is overridable and might be something else than GPIO_UNDEF
.
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.
Yea I just noticed that it's never overwritten.
So if we do away with GPIO_UNDEF
this will probably go too.
What script did you use for the conversion? |
No script, I did it with a combination of |
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.
Looks good to me.
I didn't find any obvious errors, but I also hope you relied on automatic pattern replacement so there is little potential for oversight.
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.
ACK
Contribution description
The expandable GPIO API in PR #14602 requires the comparison of structured GPIO types. This means that inline functions have be used instead of direct comparisons. For the migration process, drivers, packages and tests must first be changed so that they use these inline comparison functions.
This PR is a split-off from PR #14602 and required by PR #14602.
Testing procedure
Compilation should success. Since many sensor and actuator drivers are affected, a tests of all changes seem to be impractical. Therefore a very careful review of the changes should be done.
Issues/PRs references
Required by PR #14602.