Re: [PATCH] ALSA: hda: fix SND_INTEL_DSP_CONFIG dependency
From: Arnd Bergmann
Date: Tue Jan 05 2021 - 14:07:19 EST
On Tue, Jan 5, 2021 at 4:39 PM Kai Vehmanen
<kai.vehmanen@xxxxxxxxxxxxxxx> wrote:
> > Could it be part of the device specific driver_data?
>
> This would certainly be a clean way and allow to remove the Intel-specific
> calls from sof_pci_probe(). As a short-term solution, IS_REACHABLE()
> seems ok as well.
I looked at it some more and my conclusion is that the problem is
the way the drivers mix device specific and generic data: The generic
acpi or pci driver should never need to know about individual devices
and their dependencies. Instead of just exporting some generic
helper functions, these are the top-level drivers and the device
specific drivers are the ones exporting the data.
It's a common mistake, but it always leads to complexity like this
and we tend to end up having to undo it all.
I prototyped a patch to do this for the acpi driver, and it seems
much more straightforward this way, please have a look.
commit a83ecfed5b31dfc862e04c9bf77d2107a1047c9b
Author: Arnd Bergmann <arnd@xxxxxxxx>
Date: Tue Jan 5 19:47:35 2021 +0100
ASoC: SOF: Intel: avoid reverse module dependency
The SOF-ACPI driver is backwards from the normal Linux model, it has a
generic driver that knows about all the specific drivers, as opposed to
having hardware specific drivers that link against a common framework.
This requires ugly Kconfig magic and leads to missed dependencies as
seen in this link error:
arm-linux-gnueabi-ld: sound/soc/sof/sof-pci-dev.o: in function
`sof_acpi_probe':
sof-pci-dev.c:(.text+0x1c): undefined reference to
`snd_intel_dsp_driver_probe'
Change it to use the normal probe order of starting with a specific
device in a driver, turning the sof-acpi-dev.c driver into a library.
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
sound/soc/sof/intel/Kconfig | 34 +++---------
sound/soc/sof/intel/bdw.c | 51 ++++++++++++++++--
sound/soc/sof/intel/byt.c | 104 ++++++++++++++++++++++++++++++++----
sound/soc/sof/intel/shim.h | 10 ++--
sound/soc/sof/sof-acpi-dev.c | 122 ++-----------------------------------------
5 files changed, 156 insertions(+), 165 deletions(-)
The PCI driver is left as an exercise to the reader.
Arnd