On Sat, Feb 15, 2025, at 14:17, Krzysztof Kozlowski wrote: > Several drivers express optional Kconfig dependency with FOO || !FOO, > but for many choices this is neither suitable (lack of stubs for !FOO > like in HWMON) nor really needed and driver can be built in even if FOO > is the module. This is achieved with IS_REACHABLE, so move earlier > section from "imply" chapter to "Optional dependencies" and grow the > description. > > Cc: Masahiro Yamada <masahiroy@xxxxxxxxxx> > Cc: Arnd Bergmann <arnd@xxxxxxxx> > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx> I think this needs to be more strongly worded to heavy discourage the use of IS_REACHABLE(). In most cases, anyone trying this has just given up on writing correct dependencies and works around it in a user-hostile way. > +1. If pre-processor can discard entire optional code or module BAR does not > + provide !BAR stubs then call can be guarded with IS_REACHABLE():: > + > + foo_init() > + { > + if (IS_REACHABLE(CONFIG_BAR)) > + bar_register(&foo); > + ... > + } > + > + Drawback: this might lead to run-time debugging, when looking why > + bar_register() was not called.