ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency
PATCH 1/1 ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency
CONFIG_SND_SOC_SOF_IMX depends on CONFIG_SND_SOC_SOF, but is in turn referenced by the sof-of-dev driver. This creates a reverse dependency that manifests in a link error when CONFIG_SND_SOC_SOF_OF is built-in but CONFIG_SND_SOC_SOF_IMX=m:
sound/soc/sof/sof-of-dev.o:(.data+0x118): undefined reference to `sof_imx8_ops'
Make the latter a 'bool' symbol and change the Makefile so the imx8 driver is compiled the same way as the driver using it.
A nicer way would be to reverse the layering and move all the imx specific bits of sof-of-dev.c into the imx driver itself, which can then call into the common code. Doing this would need more testing and can be done if we add another driver like the first one.
--- sound/soc/sof/imx/Kconfig | 2 +- sound/soc/sof/imx/Makefile | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
sound/soc/sof/imx/Kconfig +1 -1
@@ -12,7 +12,7 @@ config SND_SOC_SOF_IMX_TOPLEVEL if SND_SOC_SOF_IMX_TOPLEVEL config SND_SOC_SOF_IMX8 - tristate "SOF support for i.MX8" + bool "SOF support for i.MX8" depends on IMX_SCU depends on IMX_DSP help
sound/soc/sof/imx/Makefile +3 -1
@@ -1,4 +1,6 @@ # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) snd-sof-imx8-objs := imx8.o -obj-$(CONFIG_SND_SOC_SOF_IMX8) += snd-sof-imx8.o +ifdef CONFIG_SND_SOC_SOF_IMX8 +obj-$(CONFIG_SND_SOC_SOF_OF) += snd-sof-imx8.o +endif
Signature · 1 line
2.20.0
Quoted 17 lines · Arnd Bergmann
CONFIG_SND_SOC_SOF_IMXdepends onCONFIG_SND_SOC_SOF, but is in turn referenced by the sof-of-dev driver. This creates a reverse dependency that manifests in a link error whenCONFIG_SND_SOC_SOF_OFis built-in butCONFIG_SND_SOC_SOF_IMX=m:sound/soc/sof/sof-of-dev.o:(.data+0x118): undefined reference to `sof_imx8_ops'
Make the latter a 'bool' symbol and change the
Makefileso the imx8 driver is compiled the same way as the driver using it.A nicer way would be to reverse the layering and move all the imx specific bits of
sof-of-dev.cinto the imx driver itself, which can then call into the common code. Doing this would need more testing and can be done if we add another driver like the first one.
Quoted 3 lines
Fixes f4df4e4042b0 ("ASoC: SOF: imx8: Fix COMPILE_TEST error")Fixes 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")Signed-off-by Arnd Bergmann <[email protected]>
Indeed we will need to somehow avoid getting sof_imx8_ops from sof-of-dev.c by directly referencing it.
Will keep this in mind for the next platform.
Thanks a lot Arnd!
Quoted 30 lines
--- sound/soc/sof/imx/Kconfig | 2 +- sound/soc/sof/imx/Makefile | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)sound/soc/sof/imx/Kconfig +1
-1@@ -12,7 +12,7 @@ config SND_SOC_SOF_IMX_TOPLEVEL if SND_SOC_SOF_IMX_TOPLEVEL config SND_SOC_SOF_IMX8 - tristate "SOF support for i.MX8" + bool "SOF support for i.MX8" depends on IMX_SCU depends on IMX_DSP helpsound/soc/sof/imx/Makefile +3
-1@@ -1,4 +1,6 @@ # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) snd-sof-imx8-objs := imx8.o -obj-$(CONFIG_SND_SOC_SOF_IMX8) += snd-sof-imx8.o +ifdef CONFIG_SND_SOC_SOF_IMX8 +obj-$(CONFIG_SND_SOC_SOF_OF) += snd-sof-imx8.o +endif
Quoted 7 lines · Arnd Bergmann
CONFIG_SND_SOC_SOF_IMXdepends onCONFIG_SND_SOC_SOF, but is in turn referenced by the sof-of-dev driver. This creates a reverse dependency that manifests in a link error whenCONFIG_SND_SOC_SOF_OFis built-in butCONFIG_SND_SOC_SOF_IMX=m:sound/soc/sof/sof-of-dev.o:(.data+0x118): undefined reference to `sof_imx8_ops'
Quoted 8 lines
Make the latter a 'bool' symbol and change the
Makefileso the imx8 driver is compiled the same way as the driver using it.A nicer way would be to reverse the layering and move all the imx specific bits of
sof-of-dev.cinto the imx driver itself, which can then call into the common code. Doing this would need more testing and can be done if we add another driver like the first one.
Or use something like
config SND_SOC_SOF_IMX8_SUPPORT
bool "SOF support for i.MX8"
depends on IMX_SCU
depends on IMX_DSP
config SND_SOC_SOF_IMX8
tristate
<i.mx selects>
config SND_SOC_SOF_OF
depends on OF
select SND_SOC_SOF_IMX8 if SND_SOC_SOF_IMX8_SUPPORT
That way you propagate the module/built-in information. That's how we fixed those issues for the Intel parts.
Quoted 35 lines
Fixes f4df4e4042b0 ("ASoC: SOF: imx8: Fix COMPILE_TEST error")Fixes 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")Signed-off-by Arnd Bergmann <[email protected]>--- sound/soc/sof/imx/Kconfig | 2 +- sound/soc/sof/imx/Makefile | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)sound/soc/sof/imx/Kconfig +1
-1@@ -12,7 +12,7 @@ config SND_SOC_SOF_IMX_TOPLEVEL if SND_SOC_SOF_IMX_TOPLEVEL config SND_SOC_SOF_IMX8 - tristate "SOF support for i.MX8" + bool "SOF support for i.MX8" depends on IMX_SCU depends on IMX_DSP helpsound/soc/sof/imx/Makefile +3
-1@@ -1,4 +1,6 @@ # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) snd-sof-imx8-objs := imx8.o -obj-$(CONFIG_SND_SOC_SOF_IMX8) += snd-sof-imx8.o +ifdef CONFIG_SND_SOC_SOF_IMX8 +obj-$(CONFIG_SND_SOC_SOF_OF) += snd-sof-imx8.o +endif
Quoted 28 lines · Pierre-Louis Bossart
Quoted 7 lines · Arnd Bergmann
CONFIG_SND_SOC_SOF_IMXdepends onCONFIG_SND_SOC_SOF, but is in turn referenced by the sof-of-dev driver. This creates a reverse dependency that manifests in a link error whenCONFIG_SND_SOC_SOF_OFis built-in butCONFIG_SND_SOC_SOF_IMX=m:sound/soc/sof/sof-of-dev.o:(.data+0x118): undefined reference to `sof_imx8_ops'
Quoted 8 lines
Make the latter a 'bool' symbol and change the
Makefileso the imx8 driver is compiled the same way as the driver using it.A nicer way would be to reverse the layering and move all the imx specific bits of
sof-of-dev.cinto the imx driver itself, which can then call into the common code. Doing this would need more testing and can be done if we add another driver like the first one.Or use something like
config
SND_SOC_SOF_IMX8_SUPPORT
bool "SOF support for i.MX8"
depends onIMX_SCU
depends onIMX_DSPconfig
SND_SOC_SOF_IMX8
tristate
<i.mx selects>
Quoted 6 lines
config
SND_SOC_SOF_OF
depends on OF
selectSND_SOC_SOF_IMX8ifSND_SOC_SOF_IMX8_SUPPORTThat way you propagate the module/built-in information. That's how we fixed those issues for the Intel parts.
Yes, I think that would work here as well, but it keeps even more information about the specific drivers in the generic code. It also requires adding more 'select' statements that tend to cause more problems.
The same could be done with a Kconfig-only solution avoiding 'select' such as:
config SND_SOC_SOF_IMX8_SUPPORT
bool "SOF support for i.MX8"
depends on IMX_SCU
depends on IMX_DSP
config SND_SOC_SOF_IMX8
def_tristate SND_SOC_SOF_OF
depends on SND_SOC_SOF_IMX8_SUPPORT
Arnd
Quoted 45 lines · Arnd Bergmann
Quoted 28 lines · Pierre-Louis Bossart
Quoted 7 lines · Arnd Bergmann
CONFIG_SND_SOC_SOF_IMXdepends onCONFIG_SND_SOC_SOF, but is in turn referenced by the sof-of-dev driver. This creates a reverse dependency that manifests in a link error whenCONFIG_SND_SOC_SOF_OFis built-in butCONFIG_SND_SOC_SOF_IMX=m:sound/soc/sof/sof-of-dev.o:(.data+0x118): undefined reference to `sof_imx8_ops'
Quoted 8 lines
Make the latter a 'bool' symbol and change the
Makefileso the imx8 driver is compiled the same way as the driver using it.A nicer way would be to reverse the layering and move all the imx specific bits of
sof-of-dev.cinto the imx driver itself, which can then call into the common code. Doing this would need more testing and can be done if we add another driver like the first one.Or use something like
config
SND_SOC_SOF_IMX8_SUPPORT
bool "SOF support for i.MX8"
depends onIMX_SCU
depends onIMX_DSPconfig
SND_SOC_SOF_IMX8
tristate
<i.mx selects>Quoted 6 lines
config
SND_SOC_SOF_OF
depends on OF
selectSND_SOC_SOF_IMX8ifSND_SOC_SOF_IMX8_SUPPORTThat way you propagate the module/built-in information. That's how we fixed those issues for the Intel parts.
Yes, I think that would work here as well, but it keeps even more information about the specific drivers in the generic code. It also requires adding more 'select' statements that tend to cause more problems.
The same could be done with a Kconfig-only solution avoiding 'select' such as:
Quoted 8 lines
config
SND_SOC_SOF_IMX8_SUPPORT
bool "SOF support for i.MX8"
depends onIMX_SCU
depends onIMX_DSPconfig
SND_SOC_SOF_IMX8
def_tristateSND_SOC_SOF_OF
depends onSND_SOC_SOF_IMX8_SUPPORT
Ah, nice, thanks for the suggestion! That would be my preference, we have a similar select for PCI and ACPI parts in sound/soc/sof/Kconfig and I was looking for a means to do this more elegantly. I can submit a new fix or let you sent a v2, whatever is more convenient.
Quoted 13 lines · Pierre-Louis Bossart
Quoted 12 lines · Arnd Bergmann
On Tue, Oct 1, 2019 at 5:32 PM Pierre-Louis Bossart <[email protected]> wrote:
The same could be done with a Kconfig-only solution avoiding 'select' such as:
config
SND_SOC_SOF_IMX8_SUPPORT
bool "SOF support for i.MX8"
depends onIMX_SCU
depends onIMX_DSP
Quoted 8 lines
Quoted 3 lines
config
SND_SOC_SOF_IMX8
def_tristateSND_SOC_SOF_OF
depends onSND_SOC_SOF_IMX8_SUPPORTAh, nice, thanks for the suggestion! That would be my preference, we have a similar select for PCI and ACPI parts in
sound/soc/sof/Kconfigand I was looking for a means to do this more elegantly.
I can submit a new fix or let you sent a v2, whatever is more convenient.
Ok, please send a patch then, I can add it to my randconfig test tree to make sure it covers all corner cases.
Arnd
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel