Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: Constify channel mapping array arguments in set_channel_map()

There is no need for implementations of DAI set_channel_map() to modify
contents of passed arrays with actual channel mapping. Additionally,
the caller keeps full ownership of the array.

Constify these pointer arguments so the code will be safer and easier to
read (documenting the caller's ownership).

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://msgid.link/r/20240520-asoc-x1e80100-4-channel-mapping-v4-1-f657159b4aad@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Mark Brown
965cc040 1613e604

+42 -27
+2 -2
include/sound/cs35l41.h
··· 896 896 int cs35l41_otp_unpack(struct device *dev, struct regmap *regmap); 897 897 int cs35l41_register_errata_patch(struct device *dev, struct regmap *reg, unsigned int reg_revid); 898 898 int cs35l41_set_channels(struct device *dev, struct regmap *reg, 899 - unsigned int tx_num, unsigned int *tx_slot, 900 - unsigned int rx_num, unsigned int *rx_slot); 899 + unsigned int tx_num, const unsigned int *tx_slot, 900 + unsigned int rx_num, const unsigned int *rx_slot); 901 901 int cs35l41_gpio_config(struct regmap *regmap, struct cs35l41_hw_cfg *hw_cfg); 902 902 void cs35l41_configure_cs_dsp(struct device *dev, struct regmap *reg, struct cs_dsp *dsp); 903 903 int cs35l41_set_cspl_mbox_cmd(struct device *dev, struct regmap *regmap,
+4 -4
include/sound/soc-dai.h
··· 188 188 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width); 189 189 190 190 int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai, 191 - unsigned int tx_num, unsigned int *tx_slot, 192 - unsigned int rx_num, unsigned int *rx_slot); 191 + unsigned int tx_num, const unsigned int *tx_slot, 192 + unsigned int rx_num, const unsigned int *rx_slot); 193 193 194 194 int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); 195 195 ··· 305 305 unsigned int tx_mask, unsigned int rx_mask, 306 306 int slots, int slot_width); 307 307 int (*set_channel_map)(struct snd_soc_dai *dai, 308 - unsigned int tx_num, unsigned int *tx_slot, 309 - unsigned int rx_num, unsigned int *rx_slot); 308 + unsigned int tx_num, const unsigned int *tx_slot, 309 + unsigned int rx_num, const unsigned int *rx_slot); 310 310 int (*get_channel_map)(struct snd_soc_dai *dai, 311 311 unsigned int *tx_num, unsigned int *tx_slot, 312 312 unsigned int *rx_num, unsigned int *rx_slot);
+4 -2
sound/soc/codecs/adau7118.c
··· 121 121 }; 122 122 123 123 static int adau7118_set_channel_map(struct snd_soc_dai *dai, 124 - unsigned int tx_num, unsigned int *tx_slot, 125 - unsigned int rx_num, unsigned int *rx_slot) 124 + unsigned int tx_num, 125 + const unsigned int *tx_slot, 126 + unsigned int rx_num, 127 + const unsigned int *rx_slot) 126 128 { 127 129 struct adau7118_data *st = 128 130 snd_soc_component_get_drvdata(dai->component);
+2 -2
sound/soc/codecs/cs35l41-lib.c
··· 936 936 EXPORT_SYMBOL_GPL(cs35l41_register_errata_patch); 937 937 938 938 int cs35l41_set_channels(struct device *dev, struct regmap *reg, 939 - unsigned int tx_num, unsigned int *tx_slot, 940 - unsigned int rx_num, unsigned int *rx_slot) 939 + unsigned int tx_num, const unsigned int *tx_slot, 940 + unsigned int rx_num, const unsigned int *rx_slot) 941 941 { 942 942 unsigned int val, mask; 943 943 int i;
+2 -1
sound/soc/codecs/cs35l41.c
··· 673 673 }; 674 674 675 675 static int cs35l41_set_channel_map(struct snd_soc_dai *dai, unsigned int tx_n, 676 - unsigned int *tx_slot, unsigned int rx_n, unsigned int *rx_slot) 676 + const unsigned int *tx_slot, 677 + unsigned int rx_n, const unsigned int *rx_slot) 677 678 { 678 679 struct cs35l41_private *cs35l41 = snd_soc_component_get_drvdata(dai->component); 679 680
+4 -2
sound/soc/codecs/max98504.c
··· 220 220 return 0; 221 221 } 222 222 static int max98504_set_channel_map(struct snd_soc_dai *dai, 223 - unsigned int tx_num, unsigned int *tx_slot, 224 - unsigned int rx_num, unsigned int *rx_slot) 223 + unsigned int tx_num, 224 + const unsigned int *tx_slot, 225 + unsigned int rx_num, 226 + const unsigned int *rx_slot) 225 227 { 226 228 struct max98504_priv *max98504 = snd_soc_dai_get_drvdata(dai); 227 229 struct regmap *map = max98504->regmap;
+4 -2
sound/soc/codecs/wcd9335.c
··· 1983 1983 } 1984 1984 1985 1985 static int wcd9335_set_channel_map(struct snd_soc_dai *dai, 1986 - unsigned int tx_num, unsigned int *tx_slot, 1987 - unsigned int rx_num, unsigned int *rx_slot) 1986 + unsigned int tx_num, 1987 + const unsigned int *tx_slot, 1988 + unsigned int rx_num, 1989 + const unsigned int *rx_slot) 1988 1990 { 1989 1991 struct wcd9335_codec *wcd; 1990 1992 int i;
+4 -2
sound/soc/codecs/wcd934x.c
··· 1923 1923 } 1924 1924 1925 1925 static int wcd934x_set_channel_map(struct snd_soc_dai *dai, 1926 - unsigned int tx_num, unsigned int *tx_slot, 1927 - unsigned int rx_num, unsigned int *rx_slot) 1926 + unsigned int tx_num, 1927 + const unsigned int *tx_slot, 1928 + unsigned int rx_num, 1929 + const unsigned int *rx_slot) 1928 1930 { 1929 1931 struct wcd934x_codec *wcd; 1930 1932 int i;
+10 -6
sound/soc/qcom/qdsp6/q6afe-dai.c
··· 172 172 } 173 173 174 174 static int q6tdm_set_channel_map(struct snd_soc_dai *dai, 175 - unsigned int tx_num, unsigned int *tx_slot, 176 - unsigned int rx_num, unsigned int *rx_slot) 175 + unsigned int tx_num, const unsigned int *tx_slot, 176 + unsigned int rx_num, const unsigned int *rx_slot) 177 177 { 178 178 179 179 struct q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev); ··· 250 250 } 251 251 252 252 static int q6dma_set_channel_map(struct snd_soc_dai *dai, 253 - unsigned int tx_num, unsigned int *tx_ch_mask, 254 - unsigned int rx_num, unsigned int *rx_ch_mask) 253 + unsigned int tx_num, 254 + const unsigned int *tx_ch_mask, 255 + unsigned int rx_num, 256 + const unsigned int *rx_ch_mask) 255 257 { 256 258 257 259 struct q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev); ··· 409 407 } 410 408 411 409 static int q6slim_set_channel_map(struct snd_soc_dai *dai, 412 - unsigned int tx_num, unsigned int *tx_slot, 413 - unsigned int rx_num, unsigned int *rx_slot) 410 + unsigned int tx_num, 411 + const unsigned int *tx_slot, 412 + unsigned int rx_num, 413 + const unsigned int *rx_slot) 414 414 { 415 415 struct q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev); 416 416 struct q6afe_port_config *pcfg = &dai_data->port_config[dai->id];
+4 -2
sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
··· 25 25 }; 26 26 27 27 static int q6dma_set_channel_map(struct snd_soc_dai *dai, 28 - unsigned int tx_num, unsigned int *tx_ch_mask, 29 - unsigned int rx_num, unsigned int *rx_ch_mask) 28 + unsigned int tx_num, 29 + const unsigned int *tx_ch_mask, 30 + unsigned int rx_num, 31 + const unsigned int *rx_ch_mask) 30 32 { 31 33 32 34 struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev);
+2 -2
sound/soc/soc-dai.c
··· 304 304 * configure the relationship between channel number and TDM slot number. 305 305 */ 306 306 int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai, 307 - unsigned int tx_num, unsigned int *tx_slot, 308 - unsigned int rx_num, unsigned int *rx_slot) 307 + unsigned int tx_num, const unsigned int *tx_slot, 308 + unsigned int rx_num, const unsigned int *rx_slot) 309 309 { 310 310 int ret = -ENOTSUPP; 311 311