[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260107030731.1838823-1-daniel@thingy.jp>
Date: Wed, 7 Jan 2026 12:07:29 +0900
From: Daniel Palmer <daniel@...ngy.jp>
To: linusw@...nel.org,
brgl@...nel.org,
robh@...nel.org,
saravanak@...nel.org,
linux-gpio@...r.kernel.org,
devicetree@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Daniel Palmer <daniel@...ngy.jp>
Subject: [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(-)
--
2.51.0
Powered by blists - more mailing lists