Kconfig "softdepends" idea

From: Tomi Valkeinen
Date: Tue Apr 30 2013 - 05:52:58 EST


I have an idea to improve the Kconfig dependencies, especially for
subsystem maintainers. First a bit of history:

I recently changed the Kconfig rules for omapdss driver to not depend on
OMAP platform, as the driver itself uses no OMAP specific APIs, and can
be compiled fine on, say, x86.

This got nack'ed by Linus, as omapdss is used only on OMAP, and allowing
it to be visible for other platforms is just extra clutter. I think
that's a valid point.

However, I think there are valid cases to allow a driver to be compiled
for other platforms. First two are quite minor, but I think the third
one is a major use case. I say here "omapdss" but you can replace it
with any driver that has build dependency to some platform.

1) Building omapdss with arm compiler should show all relevant warnings,
but in reality it seems that the compilers for different architectures
have slightly different behaviors. Building omapdss with a compiler for
other architecture is a good way to check for any possible errors. Also,
direct arch dependencies in a driver are generally a mistake, and
compiling with another compiler would bring these issues up.

2) When developing a new SoC, the IP in question could be in a, say,
FPGA board, attached to a PC. The same driver would thus be needed for
x86 also.

3) When making changes which affect drivers for multiple platforms (say,
fbdev changes), it is very difficult to compile test the changes. I
recently made changes to a bunch of fb drivers, and I think I managed to
compile only a few of them. To compile them all, I'd need to install all
the various cross compilers and find out which kind of kernel config is
needed to get the driver enabled.

If, on the other hand, the drivers would only depend on things they need
to get compiled, it gets much easier to compile test.

So, my idea is to have a new kind of Kconfig dependency. I'll call it
"softdepends" in lack of better name. A driver maintainer could use
"softdepends on ARCH_OMAP", instead of "depends on ARCH_OMAP", to say
that this driver does not actually build depend on ARCH_OMAP, but for
all normal purposes it does.

Normally, this would result in the same behavior as the normal
"depends", and Linus would not get a questions whether he wants to
enable this OMAP specific driver or not, and the driver would not be
visible on the menuconfig.

But the user could enable the driver if he explicitly so wants. Perhaps
a Kconfig option such as "ignore softdepends", enabling of which would
allow the user to enable the drivers that use softdepends. Or, maybe
just require the user to add the config option manually into his .config.

Now, I don't have much knowledge of the Kconfig internals, so the above
implementation ideas are just rough ideas to show the point.



Attachment: signature.asc
Description: OpenPGP digital signature