mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: SOF: amd: fix building without CONFIG_ACPI
@ 2026-09-25 13:10 Arnd Bergmann
  2026-09-25 13:32 ` Mario Limonciello
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2026-09-25 13:10 UTC (permalink / raw)
  To: Liam Girdwood, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Mark Brown, Jaroslav Kysela, Takashi Iwai, Vijendar Mukunda
  Cc: Arnd Bergmann, Kai Vehmanen, Pierre-Louis Bossart,
	Mario Limonciello, sound-open-firmware, linux-sound,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

When ACPI is disabled, this driver runs into a build failure:

sound/soc/sof/amd/acp.c:1374:13: error: call to undeclared function 'acpi_find_child_device'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
 1374 |                 pdm_dev = acpi_find_child_device(adev, ACP7X_DMIC_ADDR, 0);

The code block is already guarded by an 'if (adev)' check that
can only be true if ACPI is enabled, so add another #ifdef
to match this.

Fixes: 203ea76c4b0a ("ASoC: SOF: amd: add ACP7.B/7.F PDM controller scan and pdata propagation")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
I also tried adding ACPI Kconfig dependencies, but that quickly
got out of hand since the acp module is selected by a number of
drivers that then all need the same dependency.

It may be possible to work around this in the ACPI code by adding
a stub macro for acpi_find_child_device() that does nothing.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/soc/sof/amd/acp.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c
index b059039c9e0d..4b2d7cb244c9 100644
--- a/sound/soc/sof/amd/acp.c
+++ b/sound/soc/sof/amd/acp.c
@@ -1059,6 +1059,7 @@ int amd_sof_acp_resume(struct snd_sof_dev *sdev)
 }
 EXPORT_SYMBOL_NS(amd_sof_acp_resume, "SND_SOC_SOF_AMD_COMMON");
 
+#ifdef CONFIG_ACPI
 static void acp_sof_scan_pdm_devices(struct snd_sof_dev *sdev,
 				     struct acpi_device *pdm_dev)
 {
@@ -1083,6 +1084,7 @@ static void acp_sof_scan_pdm_devices(struct snd_sof_dev *sdev,
 	}
 	fwnode_handle_put(child);
 }
+#endif
 
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_AMD_SOUNDWIRE)
 static int acp_sof_scan_sdw_devices(struct snd_sof_dev *sdev, u64 addr)
@@ -1299,9 +1301,7 @@ int amd_sof_acp7x_probe(struct snd_sof_dev *sdev)
 	struct pci_dev *pci = to_pci_dev(sdev->dev);
 	struct acp_dev_data *adata;
 	const struct sof_amd_acp_desc *chip;
-	const union acpi_object *obj;
 	struct acpi_device *adev;
-	struct acpi_device *pdm_dev;
 	unsigned int addr;
 	unsigned int irqflags;
 	int ret;
@@ -1369,7 +1369,11 @@ int amd_sof_acp7x_probe(struct snd_sof_dev *sdev)
 		adata->is_sdw_dev = true;
 
 skip_soundwire:
+#ifdef CONFIG_ACPI
 	if (adev) {
+		struct acpi_device *pdm_dev;
+		const union acpi_object *obj;
+
 		/* DMIC ACPI child address is 2 on ACP7x platforms */
 		pdm_dev = acpi_find_child_device(adev, ACP7X_DMIC_ADDR, 0);
 		if (pdm_dev)
@@ -1379,6 +1383,7 @@ int amd_sof_acp7x_probe(struct snd_sof_dev *sdev)
 					   ACPI_TYPE_INTEGER, &obj))
 			adata->acp_sof_signed_firmware_image = obj->integer.value;
 	}
+#endif
 
 	sdev->dsp_box.offset = 0;
 	sdev->dsp_box.size = BOX_SIZE_512;
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: SOF: amd: fix building without CONFIG_ACPI
  2026-09-25 13:10 [PATCH] ASoC: SOF: amd: fix building without CONFIG_ACPI Arnd Bergmann
@ 2026-09-25 13:32 ` Mario Limonciello
  2026-09-25 16:37   ` Mukunda,Vijendar
  0 siblings, 1 reply; 4+ messages in thread
From: Mario Limonciello @ 2026-09-25 13:32 UTC (permalink / raw)
  To: Arnd Bergmann, Liam Girdwood, Peter Ujfalusi, Bard Liao,
	Daniel Baluta, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Vijendar Mukunda
  Cc: Arnd Bergmann, Kai Vehmanen, Pierre-Louis Bossart,
	sound-open-firmware, linux-sound, linux-kernel,
	Rafael J. Wysocki



On 9/25/26 08:10, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> When ACPI is disabled, this driver runs into a build failure:
> 
> sound/soc/sof/amd/acp.c:1374:13: error: call to undeclared function 'acpi_find_child_device'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>   1374 |                 pdm_dev = acpi_find_child_device(adev, ACP7X_DMIC_ADDR, 0);
> 
> The code block is already guarded by an 'if (adev)' check that
> can only be true if ACPI is enabled, so add another #ifdef
> to match this.
> 
> Fixes: 203ea76c4b0a ("ASoC: SOF: amd: add ACP7.B/7.F PDM controller scan and pdata propagation")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> I also tried adding ACPI Kconfig dependencies, but that quickly
> got out of hand since the acp module is selected by a number of
> drivers that then all need the same dependency.
> 
> It may be possible to work around this in the ACPI code by adding
> a stub macro for acpi_find_child_device() that does nothing.

I reproduced the issue as you reported.  The stub approach seems to work 
too.  I've posted that option here for Mark and Rafael to weigh out, 
thanks for the idea.

https://lore.kernel.org/linux-acpi/20260925132031.4073551-1-mario.limonciello@amd.com/

> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   sound/soc/sof/amd/acp.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c
> index b059039c9e0d..4b2d7cb244c9 100644
> --- a/sound/soc/sof/amd/acp.c
> +++ b/sound/soc/sof/amd/acp.c
> @@ -1059,6 +1059,7 @@ int amd_sof_acp_resume(struct snd_sof_dev *sdev)
>   }
>   EXPORT_SYMBOL_NS(amd_sof_acp_resume, "SND_SOC_SOF_AMD_COMMON");
>   
> +#ifdef CONFIG_ACPI
>   static void acp_sof_scan_pdm_devices(struct snd_sof_dev *sdev,
>   				     struct acpi_device *pdm_dev)
>   {
> @@ -1083,6 +1084,7 @@ static void acp_sof_scan_pdm_devices(struct snd_sof_dev *sdev,
>   	}
>   	fwnode_handle_put(child);
>   }
> +#endif
>   
>   #if IS_ENABLED(CONFIG_SND_SOC_SOF_AMD_SOUNDWIRE)
>   static int acp_sof_scan_sdw_devices(struct snd_sof_dev *sdev, u64 addr)
> @@ -1299,9 +1301,7 @@ int amd_sof_acp7x_probe(struct snd_sof_dev *sdev)
>   	struct pci_dev *pci = to_pci_dev(sdev->dev);
>   	struct acp_dev_data *adata;
>   	const struct sof_amd_acp_desc *chip;
> -	const union acpi_object *obj;
>   	struct acpi_device *adev;
> -	struct acpi_device *pdm_dev;
>   	unsigned int addr;
>   	unsigned int irqflags;
>   	int ret;
> @@ -1369,7 +1369,11 @@ int amd_sof_acp7x_probe(struct snd_sof_dev *sdev)
>   		adata->is_sdw_dev = true;
>   
>   skip_soundwire:
> +#ifdef CONFIG_ACPI
>   	if (adev) {
> +		struct acpi_device *pdm_dev;
> +		const union acpi_object *obj;
> +
>   		/* DMIC ACPI child address is 2 on ACP7x platforms */
>   		pdm_dev = acpi_find_child_device(adev, ACP7X_DMIC_ADDR, 0);
>   		if (pdm_dev)
> @@ -1379,6 +1383,7 @@ int amd_sof_acp7x_probe(struct snd_sof_dev *sdev)
>   					   ACPI_TYPE_INTEGER, &obj))
>   			adata->acp_sof_signed_firmware_image = obj->integer.value;
>   	}
> +#endif
>   
>   	sdev->dsp_box.offset = 0;
>   	sdev->dsp_box.size = BOX_SIZE_512;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: SOF: amd: fix building without CONFIG_ACPI
  2026-09-25 13:32 ` Mario Limonciello
@ 2026-09-25 16:37   ` Mukunda,Vijendar
  2026-09-25 18:10     ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Mukunda,Vijendar @ 2026-09-25 16:37 UTC (permalink / raw)
  To: Mario Limonciello, Arnd Bergmann, Liam Girdwood, Peter Ujfalusi,
	Bard Liao, Daniel Baluta, Mark Brown, Jaroslav Kysela,
	Takashi Iwai
  Cc: Arnd Bergmann, Kai Vehmanen, Pierre-Louis Bossart,
	sound-open-firmware, linux-sound, linux-kernel,
	Rafael J. Wysocki



On 9/25/26 19:02, Mario Limonciello wrote:
>
>
> On 9/25/26 08:10, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> When ACPI is disabled, this driver runs into a build failure:
>>
>> sound/soc/sof/amd/acp.c:1374:13: error: call to undeclared function 
>> 'acpi_find_child_device'; ISO C99 and later do not support implicit 
>> function declarations [-Wimplicit-function-declaration]
>>   1374 |                 pdm_dev = acpi_find_child_device(adev, 
>> ACP7X_DMIC_ADDR, 0);
>>
Hi Arnd,

Thanks for catching and fixing this issue.
As the author of the original patch, I didn't receive the
original bug report. Was it sent to a limited recipient set,
or could there have been a mailing list delivery issue?

-
Vijendar

>> The code block is already guarded by an 'if (adev)' check that
>> can only be true if ACPI is enabled, so add another #ifdef
>> to match this.
>>
>> Fixes: 203ea76c4b0a ("ASoC: SOF: amd: add ACP7.B/7.F PDM controller 
>> scan and pdata propagation")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> I also tried adding ACPI Kconfig dependencies, but that quickly
>> got out of hand since the acp module is selected by a number of
>> drivers that then all need the same dependency.
>>
>> It may be possible to work around this in the ACPI code by adding
>> a stub macro for acpi_find_child_device() that does nothing.
>
> I reproduced the issue as you reported.  The stub approach seems to 
> work too.  I've posted that option here for Mark and Rafael to weigh 
> out, thanks for the idea.
>
> https://lore.kernel.org/linux-acpi/20260925132031.4073551-1-mario.limonciello@amd.com/ 
>
>
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>   sound/soc/sof/amd/acp.c | 9 +++++++--
>>   1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c
>> index b059039c9e0d..4b2d7cb244c9 100644
>> --- a/sound/soc/sof/amd/acp.c
>> +++ b/sound/soc/sof/amd/acp.c
>> @@ -1059,6 +1059,7 @@ int amd_sof_acp_resume(struct snd_sof_dev *sdev)
>>   }
>>   EXPORT_SYMBOL_NS(amd_sof_acp_resume, "SND_SOC_SOF_AMD_COMMON");
>>   +#ifdef CONFIG_ACPI
>>   static void acp_sof_scan_pdm_devices(struct snd_sof_dev *sdev,
>>                        struct acpi_device *pdm_dev)
>>   {
>> @@ -1083,6 +1084,7 @@ static void acp_sof_scan_pdm_devices(struct 
>> snd_sof_dev *sdev,
>>       }
>>       fwnode_handle_put(child);
>>   }
>> +#endif
>>     #if IS_ENABLED(CONFIG_SND_SOC_SOF_AMD_SOUNDWIRE)
>>   static int acp_sof_scan_sdw_devices(struct snd_sof_dev *sdev, u64 
>> addr)
>> @@ -1299,9 +1301,7 @@ int amd_sof_acp7x_probe(struct snd_sof_dev *sdev)
>>       struct pci_dev *pci = to_pci_dev(sdev->dev);
>>       struct acp_dev_data *adata;
>>       const struct sof_amd_acp_desc *chip;
>> -    const union acpi_object *obj;
>>       struct acpi_device *adev;
>> -    struct acpi_device *pdm_dev;
>>       unsigned int addr;
>>       unsigned int irqflags;
>>       int ret;
>> @@ -1369,7 +1369,11 @@ int amd_sof_acp7x_probe(struct snd_sof_dev *sdev)
>>           adata->is_sdw_dev = true;
>>     skip_soundwire:
>> +#ifdef CONFIG_ACPI
>>       if (adev) {
>> +        struct acpi_device *pdm_dev;
>> +        const union acpi_object *obj;
>> +
>>           /* DMIC ACPI child address is 2 on ACP7x platforms */
>>           pdm_dev = acpi_find_child_device(adev, ACP7X_DMIC_ADDR, 0);
>>           if (pdm_dev)
>> @@ -1379,6 +1383,7 @@ int amd_sof_acp7x_probe(struct snd_sof_dev *sdev)
>>                          ACPI_TYPE_INTEGER, &obj))
>>               adata->acp_sof_signed_firmware_image = obj->integer.value;
>>       }
>> +#endif
>>         sdev->dsp_box.offset = 0;
>>       sdev->dsp_box.size = BOX_SIZE_512;
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: SOF: amd: fix building without CONFIG_ACPI
  2026-09-25 16:37   ` Mukunda,Vijendar
@ 2026-09-25 18:10     ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2026-09-25 18:10 UTC (permalink / raw)
  To: Vijendar Mukunda, Mario Limonciello, Arnd Bergmann,
	Liam Girdwood, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: Kai Vehmanen, Pierre-Louis Bossart, sound-open-firmware,
	linux-sound, linux-kernel, Rafael J . Wysocki

On Fri, Sep 25, 2026, at 18:37, Mukunda,Vijendar wrote:
> On 9/25/26 19:02, Mario Limonciello wrote:
>> On 9/25/26 08:10, Arnd Bergmann wrote:
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> When ACPI is disabled, this driver runs into a build failure:
>>>
>>> sound/soc/sof/amd/acp.c:1374:13: error: call to undeclared function 
>>> 'acpi_find_child_device'; ISO C99 and later do not support implicit 
>>> function declarations [-Wimplicit-function-declaration]
>>>   1374 |                 pdm_dev = acpi_find_child_device(adev, 
>>> ACP7X_DMIC_ADDR, 0);
>>>
> Hi Arnd,
>
> Thanks for catching and fixing this issue.
> As the author of the original patch, I didn't receive the
> original bug report. Was it sent to a limited recipient set,
> or could there have been a mailing list delivery issue?

No idea, my report is in the archive, and I assume that is how
Mario saw it:

https://lore.kernel.org/linux-sound/20260925131104.118993-1-arnd@kernel.org/

I only ran into the problem on today's linux-next during
randconfig testing.

       Arnd

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-25 18:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25 13:10 [PATCH] ASoC: SOF: amd: fix building without CONFIG_ACPI Arnd Bergmann
2026-09-25 13:32 ` Mario Limonciello
2026-09-25 16:37   ` Mukunda,Vijendar
2026-09-25 18:10     ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®