Here is my current understanding of why one would choose to use one vs the other, can you please confirm or correct me?
- Run-time vs compile-time: If you don't know whether or not you want this enabled until run time, use tristate. Else, you know at compile time, so use bool. In the cases where you
#ifdefsome optional code A inside some surrounding code B (for example including bonus features like GPU support or something) then you would need to make A be bool, even if the entire module B could be declared as tristate, since the
ifdefis evaluated at compile.
- Iteration speed: If you are developing a new bit of code, then if you declare it as a module then you can quickly unload the old version and reload your newly compiled version, without having to reboot the entire system.
- Intrusiveness: Some code would be so disruptive to to dynamically add to an already running kernel (e.g. Symmetric-Multi-Processing), so it is always bool.
Are there other factors I'm missing here? Factors I could see myself missing could be
- Rules of Thumb (e.g. "Always use bool unless you need to use tristate")
Other explanations, notes, links, and thoughts would be greatly appreciated. Thanks!