summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-utils.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>2024-06-17 15:03:21 +0200
committerMark Brown <broonie@kernel.org>2024-06-18 15:19:54 +0200
commitf3ac3da7e4d0957b3402fb31a4ca480e739e086f (patch)
tree57799620555b0db392ab2a4ec77bbc19fb9691db /sound/soc/soc-utils.c
parentASoC: Constify of_phandle_args in snd_soc_dai_link_component (diff)
downloadlinux-f3ac3da7e4d0957b3402fb31a4ca480e739e086f.tar.xz
linux-f3ac3da7e4d0957b3402fb31a4ca480e739e086f.zip
ASoC: Constify passed data to core function
Several ASoC functions receive pointers to data which is not modified, e.g. pointers to 'snd_soc_dai', 'snd_soc_pcm_runtime', 'snd_pcm_hw_params' and 'snd_soc_dai_link'. All these pointers can be made as a pointer to const. This makes code safer, serves as clear annotation of function's intentions (no ownership passed to the function, no modifications) and allows putting pointed structures in rodata (if ever applicable). Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://msgid.link/r/20240617-n-asoc-const-auto-selectable-formats-v1-3-8004f346ee38@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-utils.c')
-rw-r--r--sound/soc/soc-utils.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index d05e712c9518..5dea5609baf4 100644
--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -21,7 +21,7 @@ int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots)
}
EXPORT_SYMBOL_GPL(snd_soc_calc_frame_size);
-int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params)
+int snd_soc_params_to_frame_size(const struct snd_pcm_hw_params *params)
{
int sample_size;
@@ -40,7 +40,7 @@ int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots)
}
EXPORT_SYMBOL_GPL(snd_soc_calc_bclk);
-int snd_soc_params_to_bclk(struct snd_pcm_hw_params *params)
+int snd_soc_params_to_bclk(const struct snd_pcm_hw_params *params)
{
int ret;
@@ -79,7 +79,7 @@ EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk);
* Return: bclk frequency in Hz, else a negative error code if params format
* is invalid.
*/
-int snd_soc_tdm_params_to_bclk(struct snd_pcm_hw_params *params,
+int snd_soc_tdm_params_to_bclk(const struct snd_pcm_hw_params *params,
int tdm_width, int tdm_slots, int slot_multiple)
{
if (!tdm_slots)
@@ -211,7 +211,7 @@ static struct snd_soc_dai_driver dummy_dai = {
.ops = &dummy_dai_ops,
};
-int snd_soc_dai_is_dummy(struct snd_soc_dai *dai)
+int snd_soc_dai_is_dummy(const struct snd_soc_dai *dai)
{
if (dai->driver == &dummy_dai)
return 1;