forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 140
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
The current code includes too many parts and variables from the HDAC library when SND_SOC_SOF_HDA is not defined.
See below compile-tested code only to check what is really needed
diff --git a/sound/soc/sof/intel/hda-bus.c b/sound/soc/sof/intel/hda-bus.c
index 759f1e61a030..50b0a55ce655 100644
--- a/sound/soc/sof/intel/hda-bus.c
+++ b/sound/soc/sof/intel/hda-bus.c
@@ -80,29 +80,30 @@ static const struct hdac_io_ops io_ops = {
int sof_hda_bus_init(struct hdac_bus *bus, struct device *dev,
const struct hdac_ext_bus_ops *ext_ops)
{
- static int idx;
+ static int idx; // Is this function called multiple times?
memset(bus, 0, sizeof(*bus));
bus->dev = dev;
bus->io_ops = &io_ops;
INIT_LIST_HEAD(&bus->stream_list);
- INIT_LIST_HEAD(&bus->codec_list);
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
- bus->ops = &bus_ops;
- INIT_WORK(&bus->unsol_work, snd_hdac_bus_process_unsol_events);
-#endif
- spin_lock_init(&bus->reg_lock);
- mutex_init(&bus->cmd_mutex);
+
bus->irq = -1;
bus->ext_ops = ext_ops;
- INIT_LIST_HEAD(&bus->hlink_list);
bus->idx = idx++;
-
mutex_init(&bus->lock);
+
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
+ INIT_LIST_HEAD(&bus->codec_list);
+ spin_lock_init(&bus->reg_lock);
+ mutex_init(&bus->cmd_mutex);
+ INIT_LIST_HEAD(&bus->hlink_list);
+ bus->ops = &bus_ops;
+ INIT_WORK(&bus->unsol_work, snd_hdac_bus_process_unsol_events);
bus->cmd_dma_state = true;
+#endif
return 0;
}
diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c
index 42a986ce35a0..c8c0d405ef79 100644
--- a/sound/soc/sof/intel/hda-stream.c
+++ b/sound/soc/sof/intel/hda-stream.c
@@ -610,6 +610,7 @@ int hda_dsp_stream_init(struct snd_sof_dev *sdev)
return -ENOMEM;
}
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) // FIXME: where is this freed when HDA is enabled?
/* mem alloc for the CORB/RIRB ringbuffers */
ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev,
PAGE_SIZE, &bus->rb);
@@ -617,7 +618,7 @@ int hda_dsp_stream_init(struct snd_sof_dev *sdev)
dev_err(sdev->dev, "error: RB alloc failed\n");
return -ENOMEM;
}
-
+#endif
/* create capture streams */
for (i = 0; i < num_capture; i++) {
@keyonjie can you review and comment?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request