Skip to contentSkip to conversation

ASoC: SOF: fix undefined references

PATCH In review Pierre-Louis Bossart 3 participants 8 messages May 7, 2019 – May 8, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ASoC: SOF: fix undefined references

kbuild reported a couple of valid issues with undefined references. It's a bit embarrassing that they were not found earlier since the SOF tree is tracked for each PR...

Pierre-Louis Bossart (2):
ASoC: SOF: xtensa: fix undefined references
ASoC: SOF: core: fix undefined nocodec reference

 sound/soc/sof/core.c        | 10 +++++-----
 sound/soc/sof/intel/Kconfig |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 ASoC: SOF: xtensa: fix undefined references

The SND_SOC_INTEL_COMMON Kconfig was removed months ago from SOF Kconfig files but is still selected instead of the correct SND_SOC_SOF_INTEL_COMMON kconfig which does select xtensa stuff, leading to the following errors.

ld: sound/soc/sof/sof-acpi-dev.o:(.rodata+0x120): undefined reference to `sof_xtensa_arch_ops'
ld: sound/soc/sof/sof-acpi-dev.o:(.rodata+0x180): undefined reference to `sof_xtensa_arch_ops'
ld: sound/soc/sof/sof-acpi-dev.o:(.rodata+0x1e0): undefined reference to `sof_xtensa_arch_ops'

---
 sound/soc/sof/intel/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/intel/Kconfig +1 -1
index 32ee0fabab92..603e0db4f012 100644
@@ -36,7 +36,7 @@ config SND_SOC_SOF_INTEL_HIFI_EP_IPC
 
 config SND_SOC_SOF_INTEL_ATOM_HIFI_EP
 	tristate
-	select SND_SOC_INTEL_COMMON
+	select SND_SOC_SOF_INTEL_COMMON
 	select SND_SOC_SOF_INTEL_HIFI_EP_IPC
 	help
 	  This option is not user-selectable but automagically handled by
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Applied "ASoC: SOF: xtensa: fix undefined references" to the asoc tree

The patch

ASoC: SOF: xtensa: fix undefined references

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 78989ff8aeaddc183237da558ee07deee35fbbbd Mon Sep 17 00:00:00 2001

From: Pierre-Louis Bossart <[email protected]>
Date: Tue, 7 May 2019 11:32:35 -0500
Subject: [PATCH] ASoC: SOF: xtensa: fix undefined references

The SND_SOC_INTEL_COMMON Kconfig was removed months ago from SOF Kconfig files but is still selected instead of the correct SND_SOC_SOF_INTEL_COMMON kconfig which does select xtensa stuff, leading to the following errors.

ld: sound/soc/sof/sof-acpi-dev.o:(.rodata+0x120): undefined reference to `sof_xtensa_arch_ops'
ld: sound/soc/sof/sof-acpi-dev.o:(.rodata+0x180): undefined reference to `sof_xtensa_arch_ops'
ld: sound/soc/sof/sof-acpi-dev.o:(.rodata+0x1e0): undefined reference to `sof_xtensa_arch_ops'

---
 sound/soc/sof/intel/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/intel/Kconfig +1 -1
index 32ee0fabab92..603e0db4f012 100644
@@ -36,7 +36,7 @@ config SND_SOC_SOF_INTEL_HIFI_EP_IPC
 
 config SND_SOC_SOF_INTEL_ATOM_HIFI_EP
 	tristate
-	select SND_SOC_INTEL_COMMON
+	select SND_SOC_SOF_INTEL_COMMON
 	select SND_SOC_SOF_INTEL_HIFI_EP_IPC
 	help
 	  This option is not user-selectable but automagically handled by
Signature · 1 line
2.20.1
#3 lore raw

PATCH 2/2 ASoC: SOF: core: fix undefined nocodec reference

In reply to Pierre-Louis Bossart

The existing code mistakenly uses IS_ENABLED in C code instead of as in conditional compilation, leading to the following error:

ld: sound/soc/sof/core.o: in function `sof_machine_check':
sound/soc/sof/core.c:279: undefined reference to `sof_nocodec_setup'

Fix by using #if !IS_ENABLED()

---
 sound/soc/sof/core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/sof/core.c +5 -5
index 39cbd84ff9c8..5ddbfa8f1a28 100644
@@ -265,11 +265,10 @@ static int sof_machine_check(struct snd_sof_dev *sdev)
 	if (plat_data->machine)
 		return 0;
 
-	if (!IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC)) {
-		dev_err(sdev->dev, "error: no matching ASoC machine driver found - aborting probe\n");
-		return -ENODEV;
-	}
-
+#if !IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC)
+	dev_err(sdev->dev, "error: no matching ASoC machine driver found - aborting probe\n");
+	return -ENODEV;
+#else
 	/* fallback to nocodec mode */
 	dev_warn(sdev->dev, "No ASoC machine driver found - using nocodec\n");
 	machine = devm_kzalloc(sdev->dev, sizeof(*machine), GFP_KERNEL);
@@ -284,6 +283,7 @@ static int sof_machine_check(struct snd_sof_dev *sdev)
 	plat_data->machine = machine;
 
 	return 0;
+#endif
 }
 
 static int sof_probe_continue(struct snd_sof_dev *sdev)
Signature · 1 line
2.17.1
maintainer
#4 lore raw

Re: [PATCH 2/2] ASoC: SOF: core: fix undefined nocodec reference

Quoted 5 lines · Pierre-Louis Bossart

The existing code mistakenly uses IS_ENABLED in C code instead of as in conditional compilation, leading to the following error:

ld: sound/soc/sof/core.o: in function `sof_machine_check':
sound/soc/sof/core.c:279: undefined reference to `sof_nocodec_setup'

There's nothing wrong with using IS_ENABLED() in C code - it can be cleaner than using an ifdef to help the compiler eliminate unneeded code.

#5 lore raw

Re: [PATCH 2/2] ASoC: SOF: core: fix undefined nocodec reference

Quoted 10 lines · Mark Brown
Quoted 5 lines · Pierre-Louis Bossart

The existing code mistakenly uses IS_ENABLED in C code instead of as in conditional compilation, leading to the following error:

ld: sound/soc/sof/core.o: in function `sof_machine_check':
sound/soc/sof/core.c:279: undefined reference to `sof_nocodec_setup'

There's nothing wrong with using IS_ENABLED() in C code - it can be cleaner than using an ifdef to help the compiler eliminate unneeded code.

Agree, and we do make use of it. In this case it wasn't smart though.

#6 lore raw

Re: [PATCH 2/2] ASoC: SOF: core: fix undefined nocodec reference

Quoted 8 lines · Pierre-Louis Bossart
Quoted 4 lines · Mark Brown
Quoted 2 lines · Pierre-Louis Bossart

The existing code mistakenly uses IS_ENABLED in C code instead of as in conditional compilation, leading to the following error:

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

ld: sound/soc/sof/core.o: in function `sof_machine_check':
sound/soc/sof/core.c:279: undefined reference to `sof_nocodec_setup'

There's nothing wrong with using IS_ENABLED() in C code - it can be cleaner than using an ifdef to help the compiler eliminate unneeded code.

Agree, and we do make use of it. In this case it wasn't smart though.

An alternative solution in such a case is to provide the dummy function. For example, in sound/sof.h,

#if IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC)
int sof_nocodec_setup(struct device *dev,
struct snd_sof_pdata *sof_pdata, struct snd_soc_acpi_mach *mach, const struct sof_dev_desc *desc, const struct snd_sof_dsp_ops *ops);
#else
static inline int sof_nocodec_setup(struct device *dev,
struct snd_sof_pdata *sof_pdata, struct snd_soc_acpi_mach *mach, const struct sof_dev_desc *desc, const struct snd_sof_dsp_ops *ops)

{
	return -ENODEV;
}

#endif

Which one is better depends on the context and other part of code.

Takashi

maintainer
#7 lore raw

Applied "ASoC: SOF: core: fix undefined nocodec reference" to the asoc tree

In reply to Pierre-Louis Bossart

The patch

ASoC: SOF: core: fix undefined nocodec reference

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From ce38a75089f70f6380fc63a5478a7659b4eb3f47 Mon Sep 17 00:00:00 2001

From: Pierre-Louis Bossart <[email protected]>
Date: Tue, 7 May 2019 11:32:36 -0500
Subject: [PATCH] ASoC: SOF: core: fix undefined nocodec reference

The existing code mistakenly uses IS_ENABLED in C code instead of as in conditional compilation, leading to the following error:

ld: sound/soc/sof/core.o: in function `sof_machine_check':
sound/soc/sof/core.c:279: undefined reference to `sof_nocodec_setup'

Fix by using #if !IS_ENABLED()

---
 sound/soc/sof/core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/sof/core.c +5 -5
index 39cbd84ff9c8..5ddbfa8f1a28 100644
@@ -265,11 +265,10 @@ static int sof_machine_check(struct snd_sof_dev *sdev)
 	if (plat_data->machine)
 		return 0;
 
-	if (!IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC)) {
-		dev_err(sdev->dev, "error: no matching ASoC machine driver found - aborting probe\n");
-		return -ENODEV;
-	}
-
+#if !IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC)
+	dev_err(sdev->dev, "error: no matching ASoC machine driver found - aborting probe\n");
+	return -ENODEV;
+#else
 	/* fallback to nocodec mode */
 	dev_warn(sdev->dev, "No ASoC machine driver found - using nocodec\n");
 	machine = devm_kzalloc(sdev->dev, sizeof(*machine), GFP_KERNEL);
@@ -284,6 +283,7 @@ static int sof_machine_check(struct snd_sof_dev *sdev)
 	plat_data->machine = machine;
 
 	return 0;
+#endif
 }
 
 static int sof_probe_continue(struct snd_sof_dev *sdev)
Signature · 1 line
2.20.1