Skip to content

Commit

Permalink
ASoC: SOF: Move sof_of_machine_select() to core.c from sof-of-dev.c
Browse files Browse the repository at this point in the history
mainline inclusion
from mainline-v6.8-rc1

Commit 014fdeb ("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: 014fdeb ("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>
Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20231204033549.2020289-1-wenst@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit d0ae9dc)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
  • Loading branch information
wens authored and opsiff committed Dec 6, 2024
1 parent e205098 commit 449dca1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 32 deletions.
22 changes: 22 additions & 0 deletions sound/soc/sof/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
23 changes: 0 additions & 23 deletions sound/soc/sof/sof-of-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 0 additions & 9 deletions sound/soc/sof/sof-of-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 449dca1

Please sign in to comment.