From: bui duc phuc <[email protected]>

Add comments explaining why the .open() callbacks must return 0
on success to ensure proper rollback handling and prevent future
changes from reintroducing the issue.

Reviewed-by: Vijendar Mukunda <[email protected]>
Signed-off-by: bui duc phuc <[email protected]>
---
 sound/soc/amd/acp/acp-platform.c      | 5 +++++
 sound/soc/amd/ps/ps-pdm-dma.c         | 6 ++++++
 sound/soc/amd/ps/ps-sdw-dma.c         | 6 ++++++
 sound/soc/amd/raven/acp3x-pcm-dma.c   | 6 ++++++
 sound/soc/amd/renoir/acp3x-pdm-dma.c  | 6 ++++++
 sound/soc/amd/vangogh/acp5x-pcm-dma.c | 6 ++++++
 sound/soc/amd/yc/acp6x-pdm-dma.c      | 6 ++++++
 7 files changed, 41 insertions(+)

diff --git a/sound/soc/amd/acp/acp-platform.c b/sound/soc/amd/acp/acp-platform.c
index ba6dfe8fb6b7..f2c8853775ad 100644
--- a/sound/soc/amd/acp/acp-platform.c
+++ b/sound/soc/amd/acp/acp-platform.c
@@ -248,6 +248,11 @@ static int acp_dma_open(struct snd_soc_component 
*component, struct snd_pcm_subs
        list_add_tail(&stream->list, &chip->stream_list);
        spin_unlock_irq(&chip->acp_lock);
 
+       /*
+        * ASoC only marks the component as opened when .open() returns 0.
+        * Since snd_pcm_hw_constraint_integer() may return 1, explicitly
+        * return 0 to ensure .close() is not skipped on rollback.
+        */
        return 0;
 }
 
diff --git a/sound/soc/amd/ps/ps-pdm-dma.c b/sound/soc/amd/ps/ps-pdm-dma.c
index 28e0686e9373..12c341e89bce 100644
--- a/sound/soc/amd/ps/ps-pdm-dma.c
+++ b/sound/soc/amd/ps/ps-pdm-dma.c
@@ -211,6 +211,12 @@ static int acp63_pdm_dma_open(struct snd_soc_component 
*component,
 
        pdm_data->acp63_base = adata->acp63_base;
        runtime->private_data = pdm_data;
+
+       /*
+        * ASoC only marks the component as opened when .open() returns 0.
+        * Since snd_pcm_hw_constraint_integer() may return 1, explicitly
+        * return 0 to ensure .close() is not skipped on rollback.
+        */
        return 0;
 }
 
diff --git a/sound/soc/amd/ps/ps-sdw-dma.c b/sound/soc/amd/ps/ps-sdw-dma.c
index 553fe11a2e50..c2640985f54c 100644
--- a/sound/soc/amd/ps/ps-sdw-dma.c
+++ b/sound/soc/amd/ps/ps-sdw-dma.c
@@ -337,6 +337,12 @@ static int acp63_sdw_dma_open(struct snd_soc_component 
*component,
        stream->stream_id = cpu_dai->id;
        stream->instance = amd_manager->instance;
        runtime->private_data = stream;
+
+       /*
+        * ASoC only marks the component as opened when .open() returns 0.
+        * Since snd_pcm_hw_constraint_integer() may return 1, explicitly
+        * return 0 to ensure .close() is not skipped on rollback.
+        */
        return 0;
 }
 
diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c 
b/sound/soc/amd/raven/acp3x-pcm-dma.c
index 072f3dc35d40..765057499021 100644
--- a/sound/soc/amd/raven/acp3x-pcm-dma.c
+++ b/sound/soc/amd/raven/acp3x-pcm-dma.c
@@ -237,6 +237,12 @@ static int acp3x_dma_open(struct snd_soc_component 
*component,
 
        i2s_data->acp3x_base = adata->acp3x_base;
        runtime->private_data = i2s_data;
+
+       /*
+        * ASoC only marks the component as opened when .open() returns 0.
+        * Since snd_pcm_hw_constraint_integer() may return 1, explicitly
+        * return 0 to ensure .close() is not skipped on rollback.
+        */
        return 0;
 }
 
diff --git a/sound/soc/amd/renoir/acp3x-pdm-dma.c 
b/sound/soc/amd/renoir/acp3x-pdm-dma.c
index c0481a9ba858..89dc60849c06 100644
--- a/sound/soc/amd/renoir/acp3x-pdm-dma.c
+++ b/sound/soc/amd/renoir/acp3x-pdm-dma.c
@@ -233,6 +233,12 @@ static int acp_pdm_dma_open(struct snd_soc_component 
*component,
 
        pdm_data->acp_base = adata->acp_base;
        runtime->private_data = pdm_data;
+
+       /*
+        * ASoC only marks the component as opened when .open() returns 0.
+        * Since snd_pcm_hw_constraint_integer() may return 1, explicitly
+        * return 0 to ensure .close() is not skipped on rollback.
+        */
        return 0;
 }
 
diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c 
b/sound/soc/amd/vangogh/acp5x-pcm-dma.c
index 33d59d992ee0..72050fa2de80 100644
--- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c
+++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c
@@ -231,6 +231,12 @@ static int acp5x_dma_open(struct snd_soc_component 
*component,
        }
        i2s_data->acp5x_base = adata->acp5x_base;
        runtime->private_data = i2s_data;
+
+       /*
+        * ASoC only marks the component as opened when .open() returns 0.
+        * Since snd_pcm_hw_constraint_integer() may return 1, explicitly
+        * return 0 to ensure .close() is not skipped on rollback.
+        */
        return 0;
 }
 
diff --git a/sound/soc/amd/yc/acp6x-pdm-dma.c b/sound/soc/amd/yc/acp6x-pdm-dma.c
index afa9f66533e3..cba2509faaa1 100644
--- a/sound/soc/amd/yc/acp6x-pdm-dma.c
+++ b/sound/soc/amd/yc/acp6x-pdm-dma.c
@@ -209,6 +209,12 @@ static int acp6x_pdm_dma_open(struct snd_soc_component 
*component,
 
        pdm_data->acp6x_base = adata->acp6x_base;
        runtime->private_data = pdm_data;
+
+       /*
+        * ASoC only marks the component as opened when .open() returns 0.
+        * Since snd_pcm_hw_constraint_integer() may return 1, explicitly
+        * return 0 to ensure .close() is not skipped on rollback.
+        */
        return 0;
 }
 
-- 
2.43.0


Reply via email to