At Thu, 30 Oct 2014 21:07:19 +0530, Vinod Koul wrote:
On Thu, Oct 30, 2014 at 04:27:09PM +0100, Takashi Iwai wrote:
The standard way is something like
snd-intel-sst-y := sst.o sst_ipc.o sst_stream.o sst_drv_interface.o sst_loader.o sst_pvt.o snd-intel-sst-$(CONFIG_SND_SST_IPC_PCI) += sst_pci.o
But, when looking at the later patch, you try to build ACPI stuff into snd-intel-sst, too, and both are implemented as exclusive. This doesn't work well in general.
The hardware, firmware so the driver is pretty same. So either it gets probed as PCI device is SFI platforms and as APCI device on ACPI ones. Since the probe method is the only one differing, the machine will select either PCI or ACPI. That one would get compiled in.
... and this exclusion mechanism is missing in your patches. Your current code doesn't allow to mix them.
Am okay to change if we have better method which works for both
In general, it's better to provide individual modules for different interfaces and a common module that is referred by them. The selective build makes the build tests more difficult and is rather error-prone.
Hmmm, that makes me wonder why cant we do (based on your input above)
snd-intel-sst-y := sst.o sst_ipc.o sst_stream.o sst_drv_interface.o sst_loader.o sst_pvt.o
then either this: snd-intel-sst-$(CONFIG_SND_SST_IPC_PCI) += sst_pci.o snd-intel-sst-$(CONFIG_SND_SST_IPC_ACPI) += sst_acpi.o
This may compile both sst_pci.c and sst_acpi.c into snd-intel-sst module, so it doesn't work unless both Kconfigs are really exclusive.
Or: snd-intel-sst-pci-y += snd-intel-sst.o sst_pci.o snd-intel-sst-acpi-y += snd-intel-sst.o sst_acpi.o
This is wrong in two ways. First off, you can't link a module against another module.
Second, this causes the problem when user build one driver as a module and another as built-in. Then you'll get the doubly symbols.
So, snd-intel-sst.o must be an individual module.
Takashi