All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Arnd Bergmann <arnd@kernel.org>,
	alsa-devel@alsa-project.org, broonie@kernel.org,
	vkoul@kernel.org, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH 2/2] ASoC: SOF: SND_INTEL_DSP_CONFIG dependency
Date: Fri, 22 Jan 2021 09:58:01 +0100	[thread overview]
Message-ID: <s5hwnw58i1y.wl-tiwai@suse.de> (raw)
In-Reply-To: <20210122005725.94163-3-pierre-louis.bossart@linux.intel.com>

On Fri, 22 Jan 2021 01:57:25 +0100,
Pierre-Louis Bossart wrote:
> 
> The sof-pci-dev driver fails to link when built into the kernel
> and CONFIG_SND_INTEL_DSP_CONFIG is set to =m:
> 
> arm-linux-gnueabi-ld: sound/soc/sof/sof-pci-dev.o: in function `sof_pci_probe':
> sof-pci-dev.c:(.text+0x1c): undefined reference to `snd_intel_dsp_driver_probe'
> 
> As a temporary fix, use IS_REACHABLE to prevent the problem from
> happening. A more complete solution is to move this code to
> Intel-specific parts, restructure the drivers and Kconfig as discussed
> with Arnd Bergmann and Takashi Iwai.
> 
> Fixes: 82d9d54a6c0e ("ALSA: hda: add Intel DSP configuration / probe code")
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

This might not be good enough.  The code may still refer to the
snd_intel_dsp_probe() symbol even if IS_REACHABLE() is false
(although, practically seen, gcc should optimize it out).

You need #if IS_REACHABLE() instead of the plain if.
Then you don't need to change the indentation, and the patch will be
eventually smaller, too :)


thanks,

Takashi

> ---
>  sound/soc/sof/sof-acpi-dev.c | 11 ++++++-----
>  sound/soc/sof/sof-pci-dev.c  | 10 ++++++----
>  2 files changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/sound/soc/sof/sof-acpi-dev.c b/sound/soc/sof/sof-acpi-dev.c
> index 2a369c2c6551..cc2e257087e4 100644
> --- a/sound/soc/sof/sof-acpi-dev.c
> +++ b/sound/soc/sof/sof-acpi-dev.c
> @@ -131,12 +131,13 @@ static int sof_acpi_probe(struct platform_device *pdev)
>  	if (!id)
>  		return -ENODEV;
>  
> -	ret = snd_intel_acpi_dsp_driver_probe(dev, id->id);
> -	if (ret != SND_INTEL_DSP_DRIVER_ANY && ret != SND_INTEL_DSP_DRIVER_SOF) {
> -		dev_dbg(dev, "SOF ACPI driver not selected, aborting probe\n");
> -		return -ENODEV;
> +	if (IS_REACHABLE(CONFIG_SND_INTEL_DSP_CONFIG)) {
> +		ret = snd_intel_acpi_dsp_driver_probe(dev, id->id);
> +		if (ret != SND_INTEL_DSP_DRIVER_ANY && ret != SND_INTEL_DSP_DRIVER_SOF) {
> +			dev_dbg(dev, "SOF ACPI driver not selected, aborting probe\n");
> +			return -ENODEV;
> +		}
>  	}
> -
>  	dev_dbg(dev, "ACPI DSP detected");
>  
>  	sof_pdata = devm_kzalloc(dev, sizeof(*sof_pdata), GFP_KERNEL);
> diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c
> index 7757463bd81a..388772f9c4d2 100644
> --- a/sound/soc/sof/sof-pci-dev.c
> +++ b/sound/soc/sof/sof-pci-dev.c
> @@ -346,10 +346,12 @@ static int sof_pci_probe(struct pci_dev *pci,
>  	const struct snd_sof_dsp_ops *ops;
>  	int ret;
>  
> -	ret = snd_intel_dsp_driver_probe(pci);
> -	if (ret != SND_INTEL_DSP_DRIVER_ANY && ret != SND_INTEL_DSP_DRIVER_SOF) {
> -		dev_dbg(&pci->dev, "SOF PCI driver not selected, aborting probe\n");
> -		return -ENODEV;
> +	if (IS_REACHABLE(CONFIG_SND_INTEL_DSP_CONFIG)) {
> +		ret = snd_intel_dsp_driver_probe(pci);
> +		if (ret != SND_INTEL_DSP_DRIVER_ANY && ret != SND_INTEL_DSP_DRIVER_SOF) {
> +			dev_dbg(&pci->dev, "SOF PCI driver not selected, aborting probe\n");
> +			return -ENODEV;
> +		}
>  	}
>  	dev_dbg(&pci->dev, "PCI DSP detected");
>  
> -- 
> 2.25.1
> 

  parent reply	other threads:[~2021-01-22  8:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22  0:57 [PATCH 0/2] ASoC: SOF: partial fix to Kconfig issues Pierre-Louis Bossart
2021-01-22  0:57 ` [PATCH 1/2] ASoC: SOF: Intel: soundwire: fix select/depend unmet dependencies Pierre-Louis Bossart
2021-01-22  0:57 ` [PATCH 2/2] ASoC: SOF: SND_INTEL_DSP_CONFIG dependency Pierre-Louis Bossart
2021-01-22  5:26   ` Vinod Koul
2021-01-22  8:58   ` Takashi Iwai [this message]
2021-01-22 15:38     ` Pierre-Louis Bossart
2021-01-22 18:33       ` Arnd Bergmann
2021-01-23  8:08         ` Takashi Iwai
2021-01-25 14:17 ` [PATCH 0/2] ASoC: SOF: partial fix to Kconfig issues Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hwnw58i1y.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=broonie@kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.