RFC Let the compiler remove unneeded compatible checks.
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest2 patches 7 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | of: Add a variant of of_device_is_compatible() that can be build time culledinclude/ | +2 | 6 replies | |
| 2/2 | gpiolib: of: Remove a bunch of compatible checks for spi controllers you don't havedrivers/ | +3 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC PATCH 0/2] Let the compiler remove unneeded compatible checks.
I like devicetree but I dislike the way it removes the compiler's ability to remove dead code because the compiler can't know what is in the runtime devicetree.
One common pattern is checking if a node is compatible with some compatible string that should never happen on the target machine. i.e checking for something that only exists on a very specific PPC platform on ARM etc.
For weird people like me that want to run Linux on FPGA softcores, processors from 1979 etc it is better to have the most minimal kernel config possible and for the compiler to strip out as much unneeded code and data as possible.
The following is my quick hack to add a way to hint to the compiler whether a specific compatible check is even possible or not so it can remove deadcode and then an example usecase.
I think this is cleaner than #ifdef..#endif all over the place but maybe someone has a nicer way to do it.
Daniel Palmer (2):
of: Add a variant of of_device_is_compatible() that can be build time
culled
gpiolib: of: Remove a bunch of compatible checks for spi controllers
you don't have
drivers/gpio/gpiolib-of.c | 6 +++--- include/linux/of.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.51.0