[PATCH 0/5] ASoC: Constify snd_compress_ops
The only use of the static and global snd_compress_ops structs is to assign their address to the compress_ops field in the snd_soc_component_driver struct which is a pointer to const. Make them const to allow the compiler to put them in read-only memory.
Rikard Falkeborn (5): ASoC: cs47125: Constify static struct snd_compress_ops ASoC: wm5102: Constify static struct snd_compress_ops ASoC: wm5110: Constify static struct snd_compress_ops ASoC: qcom: q6asm-dai: Constify static struct snd_compress_ops ASoC: SOF: Intel: Constify sof_probe_compressed_ops
sound/soc/codecs/cs47l24.c | 2 +- sound/soc/codecs/wm5102.c | 2 +- sound/soc/codecs/wm5110.c | 2 +- sound/soc/qcom/qdsp6/q6asm-dai.c | 2 +- sound/soc/sof/compress.c | 2 +- sound/soc/sof/compress.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)
The snd_compress_ops structs are only stored in the compress_ops field of a snd_soc_component_driver struct, so make it const to allow the compiler to put it in read-only memory.
Signed-off-by: Rikard Falkeborn rikard.falkeborn@gmail.com --- sound/soc/codecs/cs47l24.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/cs47l24.c b/sound/soc/codecs/cs47l24.c index eaabbb56a173..6b6d08816024 100644 --- a/sound/soc/codecs/cs47l24.c +++ b/sound/soc/codecs/cs47l24.c @@ -1178,7 +1178,7 @@ static unsigned int cs47l24_digital_vu[] = { ARIZONA_DAC_DIGITAL_VOLUME_4L, };
-static struct snd_compress_ops cs47l24_compress_ops = { +static const struct snd_compress_ops cs47l24_compress_ops = { .open = cs47l24_open, .free = wm_adsp_compr_free, .set_params = wm_adsp_compr_set_params,
The snd_compress_ops structs are only stored in the compress_ops field of a snd_soc_component_driver struct, so make it const to allow the compiler to put it in read-only memory.
Signed-off-by: Rikard Falkeborn rikard.falkeborn@gmail.com --- sound/soc/codecs/wm5102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index 34b665895bdf..621598608bf0 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c @@ -1989,7 +1989,7 @@ static unsigned int wm5102_digital_vu[] = { ARIZONA_DAC_DIGITAL_VOLUME_5R, };
-static struct snd_compress_ops wm5102_compress_ops = { +static const struct snd_compress_ops wm5102_compress_ops = { .open = wm5102_open, .free = wm_adsp_compr_free, .set_params = wm_adsp_compr_set_params,
The snd_compress_ops structs are only stored in the compress_ops field of a snd_soc_component_driver struct, so make it const to allow the compiler to put it in read-only memory.
Signed-off-by: Rikard Falkeborn rikard.falkeborn@gmail.com --- sound/soc/codecs/wm5110.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index 76efca0fe515..5c2d45d05c97 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -2355,7 +2355,7 @@ static unsigned int wm5110_digital_vu[] = { ARIZONA_DAC_DIGITAL_VOLUME_6R, };
-static struct snd_compress_ops wm5110_compress_ops = { +static const struct snd_compress_ops wm5110_compress_ops = { .open = wm5110_open, .free = wm_adsp_compr_free, .set_params = wm_adsp_compr_set_params,
The snd_compress_ops structs are only stored in the compress_ops field of a snd_soc_component_driver struct, so make it const to allow the compiler to put it in read-only memory.
Signed-off-by: Rikard Falkeborn rikard.falkeborn@gmail.com --- sound/soc/qcom/qdsp6/q6asm-dai.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c index 9766725c2916..5ff56a735419 100644 --- a/sound/soc/qcom/qdsp6/q6asm-dai.c +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c @@ -1169,7 +1169,7 @@ static int q6asm_dai_compr_get_codec_caps(struct snd_soc_component *component, return 0; }
-static struct snd_compress_ops q6asm_dai_compress_ops = { +static const struct snd_compress_ops q6asm_dai_compress_ops = { .open = q6asm_dai_compr_open, .free = q6asm_dai_compr_free, .set_params = q6asm_dai_compr_set_params,
On 27/05/2021 00:10, Rikard Falkeborn wrote:
The snd_compress_ops structs are only stored in the compress_ops field of a snd_soc_component_driver struct, so make it const to allow the compiler to put it in read-only memory.
Signed-off-by: Rikard Falkeborn rikard.falkeborn@gmail.com
Reviewed-by: Srinivas Kandagatla srinivas.kandagatla@linaro.org
sound/soc/qcom/qdsp6/q6asm-dai.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c index 9766725c2916..5ff56a735419 100644 --- a/sound/soc/qcom/qdsp6/q6asm-dai.c +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c @@ -1169,7 +1169,7 @@ static int q6asm_dai_compr_get_codec_caps(struct snd_soc_component *component, return 0; }
-static struct snd_compress_ops q6asm_dai_compress_ops = { +static const struct snd_compress_ops q6asm_dai_compress_ops = { .open = q6asm_dai_compr_open, .free = q6asm_dai_compr_free, .set_params = q6asm_dai_compr_set_params,
The only usage of sof_probe_compressed_ops is to assign its address to the compress_ops field in the snd_soc_component_driver struct, which is a pointer to const. The assignment is done in sound/soc/sof/pcm.c. Make it const to allow the compiler to put it in read-only memory.
Signed-off-by: Rikard Falkeborn rikard.falkeborn@gmail.com --- sound/soc/sof/compress.c | 2 +- sound/soc/sof/compress.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sof/compress.c b/sound/soc/sof/compress.c index 2d4969c705a4..57d5bf0a171e 100644 --- a/sound/soc/sof/compress.c +++ b/sound/soc/sof/compress.c @@ -13,7 +13,7 @@ #include "ops.h" #include "probe.h"
-struct snd_compress_ops sof_probe_compressed_ops = { +const struct snd_compress_ops sof_probe_compressed_ops = { .copy = sof_probe_compr_copy, }; EXPORT_SYMBOL(sof_probe_compressed_ops); diff --git a/sound/soc/sof/compress.h b/sound/soc/sof/compress.h index ca8790bd4b13..4448c799e14b 100644 --- a/sound/soc/sof/compress.h +++ b/sound/soc/sof/compress.h @@ -13,7 +13,7 @@
#include <sound/compress_driver.h>
-extern struct snd_compress_ops sof_probe_compressed_ops; +extern const struct snd_compress_ops sof_probe_compressed_ops;
int sof_probe_compr_open(struct snd_compr_stream *cstream, struct snd_soc_dai *dai);
On Thu, 27 May 2021 01:10:08 +0200, Rikard Falkeborn wrote:
The only use of the static and global snd_compress_ops structs is to assign their address to the compress_ops field in the snd_soc_component_driver struct which is a pointer to const. Make them const to allow the compiler to put them in read-only memory.
Rikard Falkeborn (5): ASoC: cs47125: Constify static struct snd_compress_ops ASoC: wm5102: Constify static struct snd_compress_ops ASoC: wm5110: Constify static struct snd_compress_ops ASoC: qcom: q6asm-dai: Constify static struct snd_compress_ops ASoC: SOF: Intel: Constify sof_probe_compressed_ops
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/5] ASoC: cs47125: Constify static struct snd_compress_ops commit: 44b9f90705bb580a9616ecd5498dd30943c1f1ce [2/5] ASoC: wm5102: Constify static struct snd_compress_ops commit: b6f5d62e7afc398c375855c0d8105e5561f9fc37 [3/5] ASoC: wm5110: Constify static struct snd_compress_ops commit: 4127a3a541ac35360cb45909944747d61c606f0a [4/5] ASoC: qcom: q6asm-dai: Constify static struct snd_compress_ops commit: a8048051d7ce2349e4cda28954ded733d6c42028 [5/5] ASoC: SOF: Intel: Constify sof_probe_compressed_ops commit: 7db43da8c0990bb1276d1b7b185b1b9f9be6dcbb
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (3)
-
Mark Brown
-
Rikard Falkeborn
-
Srinivas Kandagatla