Skip to content

Conversation

gschorcht
Copy link
Contributor

@gschorcht gschorcht commented Aug 31, 2020

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.

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.
@gschorcht gschorcht requested review from kaspar030 and maribu August 31, 2020 11:23
@gschorcht gschorcht added Area: drivers Area: Device drivers Area: pkg Area: External package ports Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation labels Aug 31, 2020
if ((cs == SPI_CS_UNDEF) || (cs == GPIO_UNDEF)) {
if (gpio_is_equal(cs, SPI_CS_UNDEF) || !gpio_is_valid(cs)) {
Copy link
Contributor

@benpicco benpicco Aug 31, 2020

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)

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@benpicco
Copy link
Contributor

What script did you use for the conversion?

@gschorcht
Copy link
Contributor Author

What script did you use for the conversion?

No script, I did it with a combination of find and sed and manual changes.

Copy link
Contributor

@benpicco benpicco left a 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.

Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@maribu maribu added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Sep 1, 2020
@benpicco benpicco merged commit d2369a2 into RIOT-OS:master Sep 1, 2020
@gschorcht gschorcht deleted the periph/gpio/inline_functions_for_valid_and_equal branch July 31, 2025 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers Area: pkg Area: External package ports Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants