serenity
serenity copied to clipboard
Kernel: Simplify reboot & poweroff code flow a bit
Relies on #19336.
Instead of using ifdefs to use the correct platform-specific methods, we can just use the same pattern we use for the microseconds_delay function which has specific implementations for each Arch CPU subdirectory, so when linking a kernel image, the actual correct platform-specific will be used, when calling arch_specific_reboot() or arch_specific_poweroff() in the Firmware/PowerState.cpp file.
Next PR about this topic will probably change things so there will be a different process to handle Power events (maybe a WorkQueue?), and we still need to tear down the mount table safely. So this is a preparation work before that could happen.
Code changes look fine (though bordering on feng shui slightly_smiling_face) Regarding the commit message, it's a whole paragraph that is made up of a single sentence, let's try to rewrite that to something a bit more readable.
I disagree about the feng shui thing - I'd like to abstract platform-specific code into the appropriate Arch directory, as ideally we should not see any of this polluting the general Kernel code, especially not the SysFS code (which should be platform-neutral). This is not about moving code just for the sake of moving code without any actual benefit - this helps readability and keeping the general kernel code from focusing on a specific CPU Arch/platform, which is certainly a thing we need for aarch64 and future ports as well.
Code changes look fine (though bordering on feng shui slightly_smiling_face) Regarding the commit message, it's a whole paragraph that is made up of a single sentence, let's try to rewrite that to something a bit more readable.
I changed the commit message a bit, should be OK now.
Commit message looks good! Mind rebasing so CI can give us the green light?