-
Notifications
You must be signed in to change notification settings - Fork 2k
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
core|sys: Guard periph_pm calls #20523
Conversation
It would seem that either we need to require the periph_pm module in shell or make it optional... since we have many other optional modules here and we still may want the RIOT_VERSION command, lets make it optional for now.
Interesting. Historically, I think all platforms have implemented I don't believe the historic way of having one I guess, it would have made sense to have separate features for real power management and reboot capabilities. Also, I'm not sure if the reboot feature should really be tl;drI think this is an improvement and should go in. But it is not yet the final solution and will cause regressions e.g. for MSP430. |
Hmm, I updated it a bit more after discovering more unguarded calls.
I will look into that... I don't quite understand the issue with the MSP430. |
Let's first fix the current system then worry about this later... Makes sense though. |
I don't think this will change the MSP430 behavior as the whole CPU provides |
Anyone interested? ping @Teufelchen1 or maybe @maribu |
sys/shell/cmds/sys.c
Outdated
@@ -20,7 +20,9 @@ | |||
|
|||
#include <stdio.h> | |||
|
|||
#ifdef MODULE_PERIPH_PM | |||
#include "periph/pm.h" |
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.
Why do you need to guard the header?
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.
Why would we include a header that we shouldn't use?
Other places also guard headers and I think it is someone cleaner is all (I think we always include the periph headers anyways).
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.
It adds visual clutter and the header is always available.
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.
removed
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.
The coding convention btw. clearly says that @MrKevinWeiss original code is mandatory: https://github.com/RIOT-OS/RIOT/blob/master/CODING_CONVENTIONS.md#includes
However, the lived practice in RIOT's code base is to not add the guards.
I guess to reduce clutter we can always have the headers exposed since they are always included even when we are not using them.
Hmmm I have 2 acks now... Maybe @Teufelchen1 can reACK? |
Or maybe it just needs a nudge |
Contribution description
It would seem that either we need to require the periph_pm module in shell or make it optional... since we have many other optional modules here and we still may want the RIOT_VERSION command, lets make it optional for now.
Edit: I also added guards in other places that use
periph_pm
without requiring it. The syscalls in newlib and picolib are probably also a good candidate for having this optional. There are many features withing the *lib that can be used without pm stuff.Testing procedure
Remove the
periph_pm
feature from a board and try toexamples/saul
such as on this PR and you should not get a linking error that looks like:Issues/PRs references
discovered while testing #19519