serenity icon indicating copy to clipboard operation
serenity copied to clipboard

Kernel: Simplify reboot & poweroff code flow a bit

Open supercomputer7 opened this issue 2 years ago • 1 comments
trafficstars

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.

supercomputer7 avatar Jun 09 '23 19:06 supercomputer7

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.

supercomputer7 avatar Jun 10 '23 18:06 supercomputer7

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.

supercomputer7 avatar Jun 25 '23 07:06 supercomputer7

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.

supercomputer7 avatar Jun 25 '23 07:06 supercomputer7

Commit message looks good! Mind rebasing so CI can give us the green light?

IdanHo avatar Jun 25 '23 07:06 IdanHo