mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
ASoC: Address remaining PCM constraint issues
bui duc phuc <phucduc.bui@gmail.com> says: Since v1 has already been applied, this series provides incremental changes to address the remaining items from v2: - Add comments explaining why .open() and .startup() must return 0 on success to prevent the issue from being reintroduced. - Add Reviewed-by tags from Vijendar Mukunda and Chancel Liu, and Acked-by tags from Morimoto-san and Cezary. - Remove redundant integer constraints already applied by snd_dmaengine_pcm_open(). Link v1: https://lore.kernel.org/all/20261008103831.542533-1-phucduc.bui@gmail.com/ Link v2: https://lore.kernel.org/all/20261015014324.5569-1-phucduc.bui@gmail.com/ Compile-tested only. Link: https://patch.msgid.link/20261016040946.521195-1-phucduc.bui@gmail.com
This commit is contained in:
commit
8a4b7ffba6
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -535,6 +535,11 @@ static int mca_fe_startup(struct snd_pcm_substream *substream,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* ASoC only marks the DAI as started when .startup() returns 0.
|
||||
* Since snd_pcm_hw_constraint_minmax() may return 1, explicitly
|
||||
* return 0 to ensure the DAI is correctly marked as started.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -295,6 +295,11 @@ static int atmel_pcm_open(struct snd_soc_component *component,
|
|||
}
|
||||
runtime->private_data = prtd;
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
out:
|
||||
|
|
|
|||
|
|
@ -907,6 +907,11 @@ static int cs42l42_dai_startup(struct snd_pcm_substream *substream, struct snd_s
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* ASoC only marks the DAI as started when .startup() returns 0.
|
||||
* Since snd_pcm_hw_constraint_minmax() may return 1, explicitly
|
||||
* return 0 to ensure the DAI is correctly marked as started.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -501,6 +501,11 @@ static int nau8325_dai_startup(struct snd_pcm_substream *substream,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* ASoC only marks the DAI as started when .startup() returns 0.
|
||||
* Since snd_pcm_hw_constraint_minmax() may return 1, explicitly
|
||||
* return 0 to ensure the DAI is correctly marked as started.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -431,6 +431,11 @@ static int nau8540_dai_startup(struct snd_pcm_substream *substream,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* ASoC only marks the DAI as started when .startup() returns 0.
|
||||
* Since snd_pcm_hw_constraint_minmax() may return 1, explicitly
|
||||
* return 0 to ensure the DAI is correctly marked as started.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -841,6 +841,11 @@ static int nau8821_dai_startup(struct snd_pcm_substream *substream,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* ASoC only marks the DAI as started when .startup() returns 0.
|
||||
* Since snd_pcm_hw_constraint_minmax() may return 1, explicitly
|
||||
* return 0 to ensure the DAI is correctly marked as started.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1073,6 +1073,11 @@ static int nau8824_dai_startup(struct snd_pcm_substream *substream,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* ASoC only marks the DAI as started when .startup() returns 0.
|
||||
* Since snd_pcm_hw_constraint_minmax() may return 1, explicitly
|
||||
* return 0 to ensure the DAI is correctly marked as started.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1273,6 +1273,11 @@ static int nau8825_dai_startup(struct snd_pcm_substream *substream,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* ASoC only marks the DAI as started when .startup() returns 0.
|
||||
* Since snd_pcm_hw_constraint_minmax() may return 1, explicitly
|
||||
* return 0 to ensure the DAI is correctly marked as started.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -860,6 +860,11 @@ static int wm8580_playback_startup(struct snd_pcm_substream *substream,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* ASoC only marks the DAI as started when .startup() returns 0.
|
||||
* Since snd_pcm_hw_constraint_minmax() may return 1, explicitly
|
||||
* return 0 to ensure the DAI is correctly marked as started.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,11 @@ static int wm8782_dai_startup(struct snd_pcm_substream *sub, struct snd_soc_dai
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* ASoC only marks the DAI as started when .startup() returns 0.
|
||||
* Since snd_pcm_hw_constraint_minmax() may return 1, explicitly
|
||||
* return 0 to ensure the DAI is correctly marked as started.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -269,6 +269,12 @@ static int imx_rpmsg_pcm_open(struct snd_soc_component *component,
|
|||
info->stream_timer[substream->stream].substream = substream;
|
||||
timer_setup(&info->stream_timer[substream->stream].timer,
|
||||
imx_rpmsg_timer_callback, 0);
|
||||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -341,6 +341,11 @@ static int sst_media_open(struct snd_pcm_substream *substream,
|
|||
|
||||
stream = NULL;
|
||||
|
||||
/*
|
||||
* ASoC only marks the DAI as started when .startup() returns 0.
|
||||
* Since snd_pcm_hw_constraint_integer() may return 1, explicitly
|
||||
* return 0 to ensure .shutdown() is not skipped on rollback.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1820,6 +1820,11 @@ static int fsi_pcm_open(struct snd_soc_component *component,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* 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 the component is correctly marked as opened.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -419,19 +419,13 @@ static int msiof_open(struct snd_soc_component *component,
|
|||
return PTR_ERR(chan);
|
||||
|
||||
ret = snd_dmaengine_pcm_open(substream, chan);
|
||||
if (ret < 0)
|
||||
goto open_err_dma;
|
||||
|
||||
snd_soc_set_runtime_hwparams(substream, &msiof_pcm_hardware);
|
||||
|
||||
ret = snd_pcm_hw_constraint_integer(substream->runtime, SNDRV_PCM_HW_PARAM_PERIODS);
|
||||
|
||||
open_err_dma:
|
||||
if (ret < 0) {
|
||||
dma_release_channel(chan);
|
||||
return ret;
|
||||
}
|
||||
|
||||
snd_soc_set_runtime_hwparams(substream, &msiof_pcm_hardware);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -946,19 +946,11 @@ static int rz_ssi_pcm_open_pio(struct snd_soc_component *component,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rz_ssi_pcm_open_dma(struct snd_soc_component *component,
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = snd_pcm_hw_constraint_integer(substream->runtime,
|
||||
SNDRV_PCM_HW_PARAM_PERIODS);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* 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 the component is correctly marked as opened.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1012,7 +1004,6 @@ static const struct snd_soc_component_driver rz_ssi_soc_component_pio = {
|
|||
|
||||
static const struct snd_soc_component_driver rz_ssi_soc_component_dma = {
|
||||
.name = "rz-ssi",
|
||||
.open = rz_ssi_pcm_open_dma,
|
||||
.legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -266,6 +266,11 @@ static int rockchip_sound_startup(struct snd_pcm_substream *substream)
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* ASoC only marks the DAI link as started when .startup() returns 0.
|
||||
* Since snd_pcm_hw_constraint_minmax() may return 1, explicitly
|
||||
* return 0 to ensure the DAI link is correctly marked as started.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -202,6 +202,11 @@ static int rk_aif1_startup(struct snd_pcm_substream *substream)
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* ASoC only marks the DAI link as started when .startup() returns 0.
|
||||
* Since snd_pcm_hw_constraint_minmax() may return 1, explicitly
|
||||
* return 0 to ensure the DAI link is correctly marked as started.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user