At Tue, 3 Jun 2008 11:40:48 +0100, Mark Brown wrote:
The following couple of patches update the jack reporting API I posted last week with the feedback I have received so far. The changes since the last submision are:
- Addition of snd_jack_set_parent(), allowing drivers to override the default parent for the input device prior to registration.
- The jack detection support is now included unconditionally in ALSA, requiring a dependency on the input subsystem.
I'm not entirely happy with making ALSA depend on input but given that it is only optional on embedded systems and that the input core is not that large it seemed the best way of ensuring that the input subsystem is available for the jack API without hassle for drivers using it, especially given the lack of dependency propagation from select.
I also feel uneasy that it's built in unconditionally and requires an additional dependency on CONFIG_INPUT. The fact that both SND and INPUT can be modules makes things a bit complicated.
As a workaround, how about to select with "if" conditions? For example, in sound/core/Kconfig,
config SND_JACK bool
while the driver requires SND_JACK has the below:
config SND_FOO tristate "..." ... select SND_JACK if INPUT=y || INPUT=SND
Yeah, it looks horrible at a first glance, but it's a known workaround for reverse selections...
In sound/core/Makefile, just add the line:
snd-$(CONFIG_SND_JACK) += jack.o
so that the code is built into snd module only when necessary.
Also, sound/jack.h should provide empty inline functions for the case CONFIG_SND_JACK=n. Then you'll be able to reduce ifdefs in the driver codes.
thanks,
Takashi