Skip to content

boards: drop board_init() from board.h#17707

Merged
benpicco merged 2 commits intoRIOT-OS:masterfrom
benpicco:board_init-cleanup
Feb 26, 2022
Merged

boards: drop board_init() from board.h#17707
benpicco merged 2 commits intoRIOT-OS:masterfrom
benpicco:board_init-cleanup

Conversation

@benpicco
Copy link
Contributor

Contribution description

This removes the per-board declaration of board_init() and places it in kernel_init.h next to kernel_init().

Testing procedure

Issues/PRs references

split off #17008
similar to #16013

@benpicco benpicco requested a review from chrysn February 25, 2022 14:05
@benpicco benpicco added the Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation label Feb 25, 2022
@github-actions github-actions bot added Area: boards Area: Board ports Area: core Area: RIOT kernel. Handle PRs marked with this with care! Platform: native Platform: This PR/issue effects the native platform labels Feb 25, 2022
@benpicco benpicco removed the Platform: native Platform: This PR/issue effects the native platform label Feb 25, 2022
@benpicco benpicco requested a review from fjmolinas February 25, 2022 14:09
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Feb 26, 2022
Copy link
Member

@chrysn chrysn left a comment

Choose a reason for hiding this comment

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

Nice how the declaration in kernel_init.h appears to resolve all the trouble I've had and never resolved in #16013.

Two extern int _...; are removed in the native version, but I checked that they are not used anywhere else, so they're good to go. (Could be committed separately, but then again it's an obvious cleanup. They were probably missed when the extern introduced in 864267f and its use discontinued in 0e4386a).

I reviewed this in code changes alone and did not test it -- but I don't see any realistic and not-already-highly-nondeterministic possibility that something here results in a runtime change but not a build failure.

@benpicco benpicco merged commit 7c2f062 into RIOT-OS:master Feb 26, 2022
@benpicco benpicco deleted the board_init-cleanup branch February 26, 2022 18:35
@fjmolinas
Copy link
Contributor

@benpicco I don't like how this PR was merged, in #17008 I expressed that I was unsure that kernel_init.h was the right place for this function declaration #17008 (comment), in the matrix I also brought this up, so just merging this as soon as the first ACK was in seems does not seem like a good way to proceed. I'm not, in any case, asking for a revert or anything like that, I just want to state that I don't like how this was handled.

@chrysn
Copy link
Member

chrysn commented Feb 28, 2022

I was unaware of that comment and didn't go through all details of 17008 in my review. Sorry for the oversight. A comment on this thread might have helped me find the concern, but so would have a more thorough read of the related issues.

I don't see this big an importance in where it is placed: Sure it makes it visible to users of kernel_init.h, but then again, nobody outside the single location in startup would ever call board_init anyway. (Unlike the various other init functions that may need to be called when some auto-init stuff is disabled). That is not to play down the concern, but to remove urgency: It's not like any new caller of board_init will pop up for the duration this sits in kernel_init.h that will later be missing the declaration.

Quite some value of the declaration is documentation (and now that there's a central location to document, I'd like to extend it or at least reference to the existing docs). What does it do outside of docs? It ensures that no extern void board_init(void); are needed at the users' site (there are already a few), and makes warnings pop up when an explicit implementer messes up the signature. The user case suggests to put it into a dedicated header (say, board_init.h), but only weakly (as all users of one also use the other). The latter case of the implementers indicates that it may be good to place it where it is included commonly (because implementing the function w/o a preceding forward declaration is not something the compiler would complain about). Inconveniently, there doesn't appear to be a common include from board.h files (cpu.h is included often, but that sounds weird).

So my suggestion would be a new board_init.h -- but it's all weak cases. I wouldn't hope for strong consensus on where to place it (I expect many "don't care"s), but at least a strong opinion would be good before seettling on a location (and mine is weak).

@benpicco
Copy link
Contributor Author

@fjmolinas sorry I didn't understand your comment as a general objection to place it in kernel_init.h but rather a concern that @chrysn opted for board_init.h and you wanted his option on this too - so when he ACKed this PR I assumed all is fine.

Anyway I don't think the location matters much - what do you propose?

@kaspar030
Copy link
Contributor

what do you propose?

Enable the branch protection that forces all conversations of a PR to be "resolved". Just so we don't accidentally forget concerns.

From my side, I think the location really doesn't matter that much, and this is a single line void foo(void) define that really doesn't hurt. I think a dedicated header would hurt more.

@benpicco
Copy link
Contributor Author

Enable the branch protection that forces all conversations of a PR to be "resolved". Just so we don't accidentally forget concerns.

I have a feeling we are more likely to accidentally forget PRs than to forget concerns…

@chrysn
Copy link
Member

chrysn commented Feb 28, 2022

Enable the branch protection that forces all conversations of a PR to be "resolved". Just so we don't accidentally forget concerns.

Wouldn't have helped here because the comment was in another issue.

I have no strong preference whether or not open comments should stop merging, because objections can be encoded either in threads-left-unresolved or in reviews-requesting-changes.

@fjmolinas
Copy link
Contributor

I'm fine with the changes in this PR, my comment was solely to point out that I thought concerns I raised in the previous PR that was doing the same were ignored, and since the PR was opened on Friday, it didn't really give me time to comment again on it.

But as @benpicco explained this was just a misunderstanding, no hard feelings here, just thought the comment needed to be made. I think the lesson is that when a PR is opened spawning from another person that opens the PR as well the reviewer could try to resume the status of the previous PR in the PR description (best effort, of course).

Branch protection on all conversations resolved would not have helped here, and I don't think it really needed, I think as a community we usually never disregard comments made in a PR.

@kaspar030
Copy link
Contributor

ok, I see the extra branch protections feel like more complexity where there should be less.

@OlegHahm OlegHahm added this to the Release 2022.04 milestone Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: boards Area: Board ports Area: core Area: RIOT kernel. Handle PRs marked with this with care! 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.

5 participants