diff mbox series

ASoC: SOF: Move sof_of_machine_select() to core.c from sof-of-dev.c

Message ID 20231204033549.2020289-1-wenst@chromium.org (mailing list archive)
State Accepted
Commit d0ae9dc48e24f5f704abcbb2dca3e4651bf0ff59
Headers show
Series ASoC: SOF: Move sof_of_machine_select() to core.c from sof-of-dev.c | expand

Commit Message

Chen-Yu Tsai Dec. 4, 2023, 3:35 a.m. UTC
This reverts commit 014fdeb0d747304111cfecf93df4407c1a0c80db.

Commit 014fdeb0d747 ("ASoC: SOF: Move sof_of_machine_select() to
sof-of-dev.c from sof-audio.c") caused a circular dependency between
the snd_sof and snd_sof_of modules:

	depmod: ERROR: Cycle detected: snd_sof -> snd_sof_of -> snd_sof
	depmod: ERROR: Found 2 modules in dependency cycles!

Move the function back with sof_machine_select().

Fixes: 014fdeb0d747 ("ASoC: SOF: Move sof_of_machine_select() to sof-of-dev.c from sof-audio.c")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
Not sure what the proper arrangement would be, but this gets my builds
going again.

 sound/soc/sof/core.c       | 22 ++++++++++++++++++++++
 sound/soc/sof/sof-of-dev.c | 23 -----------------------
 sound/soc/sof/sof-of-dev.h |  9 ---------
 3 files changed, 22 insertions(+), 32 deletions(-)

Comments

Peter Ujfalusi Dec. 4, 2023, 11:04 a.m. UTC | #1
On 04/12/2023 05:35, Chen-Yu Tsai wrote:
> This reverts commit 014fdeb0d747304111cfecf93df4407c1a0c80db.
> 
> Commit 014fdeb0d747 ("ASoC: SOF: Move sof_of_machine_select() to
> sof-of-dev.c from sof-audio.c") caused a circular dependency between
> the snd_sof and snd_sof_of modules:
> 
> 	depmod: ERROR: Cycle detected: snd_sof -> snd_sof_of -> snd_sof
> 	depmod: ERROR: Found 2 modules in dependency cycles!
> 
> Move the function back with sof_machine_select().
> 
> Fixes: 014fdeb0d747 ("ASoC: SOF: Move sof_of_machine_select() to sof-of-dev.c from sof-audio.c")
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>

Oh, I have re-done the compile test and that does not detect this (I
don't have ARM device to runtime test it), but looks valid.
I wonder if we should do this similarly to acpi machine select via ops
to cut the circular dependency?
That can be done in a followup patch.

Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

> ---
> Not sure what the proper arrangement would be, but this gets my builds
> going again.
> 
>  sound/soc/sof/core.c       | 22 ++++++++++++++++++++++
>  sound/soc/sof/sof-of-dev.c | 23 -----------------------
>  sound/soc/sof/sof-of-dev.h |  9 ---------
>  3 files changed, 22 insertions(+), 32 deletions(-)
> 
> diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c
> index a2afec8f5879..425b023b03b4 100644
> --- a/sound/soc/sof/core.c
> +++ b/sound/soc/sof/core.c
> @@ -144,6 +144,28 @@ void sof_set_fw_state(struct snd_sof_dev *sdev, enum sof_fw_state new_state)
>  }
>  EXPORT_SYMBOL(sof_set_fw_state);
>  
> +static struct snd_sof_of_mach *sof_of_machine_select(struct snd_sof_dev *sdev)
> +{
> +	struct snd_sof_pdata *sof_pdata = sdev->pdata;
> +	const struct sof_dev_desc *desc = sof_pdata->desc;
> +	struct snd_sof_of_mach *mach = desc->of_machines;
> +
> +	if (!mach)
> +		return NULL;
> +
> +	for (; mach->compatible; mach++) {
> +		if (of_machine_is_compatible(mach->compatible)) {
> +			sof_pdata->tplg_filename = mach->sof_tplg_filename;
> +			if (mach->fw_filename)
> +				sof_pdata->fw_filename = mach->fw_filename;
> +
> +			return mach;
> +		}
> +	}
> +
> +	return NULL;
> +}
> +
>  /* SOF Driver enumeration */
>  static int sof_machine_check(struct snd_sof_dev *sdev)
>  {
> diff --git a/sound/soc/sof/sof-of-dev.c b/sound/soc/sof/sof-of-dev.c
> index fa92da5ee9b3..b9a499e92b9a 100644
> --- a/sound/soc/sof/sof-of-dev.c
> +++ b/sound/soc/sof/sof-of-dev.c
> @@ -41,29 +41,6 @@ static void sof_of_probe_complete(struct device *dev)
>  	pm_runtime_enable(dev);
>  }
>  
> -struct snd_sof_of_mach *sof_of_machine_select(struct snd_sof_dev *sdev)
> -{
> -	struct snd_sof_pdata *sof_pdata = sdev->pdata;
> -	const struct sof_dev_desc *desc = sof_pdata->desc;
> -	struct snd_sof_of_mach *mach = desc->of_machines;
> -
> -	if (!mach)
> -		return NULL;
> -
> -	for (; mach->compatible; mach++) {
> -		if (of_machine_is_compatible(mach->compatible)) {
> -			sof_pdata->tplg_filename = mach->sof_tplg_filename;
> -			if (mach->fw_filename)
> -				sof_pdata->fw_filename = mach->fw_filename;
> -
> -			return mach;
> -		}
> -	}
> -
> -	return NULL;
> -}
> -EXPORT_SYMBOL(sof_of_machine_select);
> -
>  int sof_of_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
> diff --git a/sound/soc/sof/sof-of-dev.h b/sound/soc/sof/sof-of-dev.h
> index 547e358a37e3..b6cc70595f3b 100644
> --- a/sound/soc/sof/sof-of-dev.h
> +++ b/sound/soc/sof/sof-of-dev.h
> @@ -16,15 +16,6 @@ struct snd_sof_of_mach {
>  	const char *sof_tplg_filename;
>  };
>  
> -#if IS_ENABLED(CONFIG_SND_SOC_SOF_OF_DEV)
> -struct snd_sof_of_mach *sof_of_machine_select(struct snd_sof_dev *sdev);
> -#else
> -static inline struct snd_sof_of_mach *sof_of_machine_select(struct snd_sof_dev *sdev)
> -{
> -	return NULL;
> -}
> -#endif
> -
>  extern const struct dev_pm_ops sof_of_pm;
>  
>  int sof_of_probe(struct platform_device *pdev);
Daniel Baluta Dec. 4, 2023, 11:38 a.m. UTC | #2
On Mon, Dec 4, 2023 at 5:46 AM Chen-Yu Tsai <wenst@chromium.org> wrote:
>
> This reverts commit 014fdeb0d747304111cfecf93df4407c1a0c80db.
>
> Commit 014fdeb0d747 ("ASoC: SOF: Move sof_of_machine_select() to
> sof-of-dev.c from sof-audio.c") caused a circular dependency between
> the snd_sof and snd_sof_of modules:
>
>         depmod: ERROR: Cycle detected: snd_sof -> snd_sof_of -> snd_sof
>         depmod: ERROR: Found 2 modules in dependency cycles!
>
> Move the function back with sof_machine_select().
>
> Fixes: 014fdeb0d747 ("ASoC: SOF: Move sof_of_machine_select() to sof-of-dev.c from sof-audio.c")
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>

Thanks for fixing this.

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Mark Brown Dec. 4, 2023, 12:27 p.m. UTC | #3
On Mon, Dec 04, 2023 at 11:35:47AM +0800, Chen-Yu Tsai wrote:

> This reverts commit 014fdeb0d747304111cfecf93df4407c1a0c80db.

Please include human readable descriptions of things like commits and
issues being discussed in e-mail in your mails, this makes them much
easier for humans to read especially when they have no internet access.
I do frequently catch up on my mail on flights or while otherwise
travelling so this is even more pressing for me than just being about
making things a bit easier to read.
Mark Brown Dec. 4, 2023, 7:30 p.m. UTC | #4
On Mon, 04 Dec 2023 11:35:47 +0800, Chen-Yu Tsai wrote:
> This reverts commit 014fdeb0d747304111cfecf93df4407c1a0c80db.
> 
> Commit 014fdeb0d747 ("ASoC: SOF: Move sof_of_machine_select() to
> sof-of-dev.c from sof-audio.c") caused a circular dependency between
> the snd_sof and snd_sof_of modules:
> 
> 	depmod: ERROR: Cycle detected: snd_sof -> snd_sof_of -> snd_sof
> 	depmod: ERROR: Found 2 modules in dependency cycles!
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: SOF: Move sof_of_machine_select() to core.c from sof-of-dev.c
      commit: d0ae9dc48e24f5f704abcbb2dca3e4651bf0ff59

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
Mark Brown Dec. 14, 2023, 10:56 a.m. UTC | #5
On Mon, Dec 04, 2023 at 11:35:47AM +0800, Chen-Yu Tsai wrote:
> This reverts commit 014fdeb0d747304111cfecf93df4407c1a0c80db.
> 
> Commit 014fdeb0d747 ("ASoC: SOF: Move sof_of_machine_select() to
> sof-of-dev.c from sof-audio.c") caused a circular dependency between
> the snd_sof and snd_sof_of modules:

This doesn't apply against current code, please check and resend.

Please include human readable descriptions of things like commits and
issues being discussed in e-mail in your mails, this makes them much
easier for humans to read especially when they have no internet access.
I do frequently catch up on my mail on flights or while otherwise
travelling so this is even more pressing for me than just being about
making things a bit easier to read.
diff mbox series

Patch

diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c
index a2afec8f5879..425b023b03b4 100644
--- a/sound/soc/sof/core.c
+++ b/sound/soc/sof/core.c
@@ -144,6 +144,28 @@  void sof_set_fw_state(struct snd_sof_dev *sdev, enum sof_fw_state new_state)
 }
 EXPORT_SYMBOL(sof_set_fw_state);
 
+static struct snd_sof_of_mach *sof_of_machine_select(struct snd_sof_dev *sdev)
+{
+	struct snd_sof_pdata *sof_pdata = sdev->pdata;
+	const struct sof_dev_desc *desc = sof_pdata->desc;
+	struct snd_sof_of_mach *mach = desc->of_machines;
+
+	if (!mach)
+		return NULL;
+
+	for (; mach->compatible; mach++) {
+		if (of_machine_is_compatible(mach->compatible)) {
+			sof_pdata->tplg_filename = mach->sof_tplg_filename;
+			if (mach->fw_filename)
+				sof_pdata->fw_filename = mach->fw_filename;
+
+			return mach;
+		}
+	}
+
+	return NULL;
+}
+
 /* SOF Driver enumeration */
 static int sof_machine_check(struct snd_sof_dev *sdev)
 {
diff --git a/sound/soc/sof/sof-of-dev.c b/sound/soc/sof/sof-of-dev.c
index fa92da5ee9b3..b9a499e92b9a 100644
--- a/sound/soc/sof/sof-of-dev.c
+++ b/sound/soc/sof/sof-of-dev.c
@@ -41,29 +41,6 @@  static void sof_of_probe_complete(struct device *dev)
 	pm_runtime_enable(dev);
 }
 
-struct snd_sof_of_mach *sof_of_machine_select(struct snd_sof_dev *sdev)
-{
-	struct snd_sof_pdata *sof_pdata = sdev->pdata;
-	const struct sof_dev_desc *desc = sof_pdata->desc;
-	struct snd_sof_of_mach *mach = desc->of_machines;
-
-	if (!mach)
-		return NULL;
-
-	for (; mach->compatible; mach++) {
-		if (of_machine_is_compatible(mach->compatible)) {
-			sof_pdata->tplg_filename = mach->sof_tplg_filename;
-			if (mach->fw_filename)
-				sof_pdata->fw_filename = mach->fw_filename;
-
-			return mach;
-		}
-	}
-
-	return NULL;
-}
-EXPORT_SYMBOL(sof_of_machine_select);
-
 int sof_of_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
diff --git a/sound/soc/sof/sof-of-dev.h b/sound/soc/sof/sof-of-dev.h
index 547e358a37e3..b6cc70595f3b 100644
--- a/sound/soc/sof/sof-of-dev.h
+++ b/sound/soc/sof/sof-of-dev.h
@@ -16,15 +16,6 @@  struct snd_sof_of_mach {
 	const char *sof_tplg_filename;
 };
 
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_OF_DEV)
-struct snd_sof_of_mach *sof_of_machine_select(struct snd_sof_dev *sdev);
-#else
-static inline struct snd_sof_of_mach *sof_of_machine_select(struct snd_sof_dev *sdev)
-{
-	return NULL;
-}
-#endif
-
 extern const struct dev_pm_ops sof_of_pm;
 
 int sof_of_probe(struct platform_device *pdev);