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

ASoC: qcom: Use snd_soc_substream_to_rtd() for accessing private_data

Do not open-code snd_soc_substream_to_rtd().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240430-asoc-snd-substream-clean-v1-1-6f8a8902b479@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Mark Brown
77678a25 ba2a2c37

+31 -31
+2 -2
sound/soc/qcom/apq8016_sbc.c
··· 192 192 193 193 static int msm8916_qdsp6_startup(struct snd_pcm_substream *substream) 194 194 { 195 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 195 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 196 196 struct snd_soc_card *card = rtd->card; 197 197 struct apq8016_sbc_data *data = snd_soc_card_get_drvdata(card); 198 198 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); ··· 213 213 214 214 static void msm8916_qdsp6_shutdown(struct snd_pcm_substream *substream) 215 215 { 216 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 216 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 217 217 struct snd_soc_card *card = rtd->card; 218 218 struct apq8016_sbc_data *data = snd_soc_card_get_drvdata(card); 219 219 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
+1 -1
sound/soc/qcom/qdsp6/q6apm-dai.c
··· 331 331 struct snd_pcm_substream *substream) 332 332 { 333 333 struct snd_pcm_runtime *runtime = substream->runtime; 334 - struct snd_soc_pcm_runtime *soc_prtd = substream->private_data; 334 + struct snd_soc_pcm_runtime *soc_prtd = snd_soc_substream_to_rtd(substream); 335 335 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(soc_prtd, 0); 336 336 struct device *dev = component->dev; 337 337 struct q6apm_dai_data *pdata;
+5 -5
sound/soc/qcom/sc7180.c
··· 200 200 201 201 static int sc7180_snd_startup(struct snd_pcm_substream *substream) 202 202 { 203 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 203 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 204 204 struct snd_soc_card *card = rtd->card; 205 205 struct sc7180_snd_data *data = snd_soc_card_get_drvdata(card); 206 206 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); ··· 234 234 235 235 static int sc7180_qdsp_snd_startup(struct snd_pcm_substream *substream) 236 236 { 237 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 237 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 238 238 struct snd_soc_card *card = rtd->card; 239 239 struct sc7180_snd_data *data = snd_soc_card_get_drvdata(card); 240 240 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); ··· 307 307 308 308 static void sc7180_snd_shutdown(struct snd_pcm_substream *substream) 309 309 { 310 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 310 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 311 311 struct snd_soc_card *card = rtd->card; 312 312 struct sc7180_snd_data *data = snd_soc_card_get_drvdata(card); 313 313 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); ··· 334 334 335 335 static void sc7180_qdsp_snd_shutdown(struct snd_pcm_substream *substream) 336 336 { 337 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 337 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 338 338 struct snd_soc_card *card = rtd->card; 339 339 struct sc7180_snd_data *data = snd_soc_card_get_drvdata(card); 340 340 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); ··· 389 389 390 390 static int sc7180_adau7002_snd_startup(struct snd_pcm_substream *substream) 391 391 { 392 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 392 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 393 393 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 394 394 struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); 395 395 struct snd_pcm_runtime *runtime = substream->runtime;
+6 -6
sound/soc/qcom/sc7280.c
··· 205 205 struct snd_pcm_hw_params *params) 206 206 { 207 207 struct snd_pcm_runtime *runtime = substream->runtime; 208 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 208 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 209 209 struct snd_soc_dai *codec_dai; 210 210 const struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 211 211 struct sc7280_snd_data *pdata = snd_soc_card_get_drvdata(rtd->card); ··· 237 237 238 238 static int sc7280_snd_swr_prepare(struct snd_pcm_substream *substream) 239 239 { 240 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 240 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 241 241 const struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 242 242 struct sc7280_snd_data *data = snd_soc_card_get_drvdata(rtd->card); 243 243 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; ··· 268 268 269 269 static int sc7280_snd_prepare(struct snd_pcm_substream *substream) 270 270 { 271 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 271 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 272 272 const struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 273 273 274 274 switch (cpu_dai->id) { ··· 287 287 288 288 static int sc7280_snd_hw_free(struct snd_pcm_substream *substream) 289 289 { 290 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 290 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 291 291 struct sc7280_snd_data *data = snd_soc_card_get_drvdata(rtd->card); 292 292 const struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 293 293 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; ··· 312 312 313 313 static void sc7280_snd_shutdown(struct snd_pcm_substream *substream) 314 314 { 315 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 315 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 316 316 struct snd_soc_card *card = rtd->card; 317 317 struct sc7280_snd_data *data = snd_soc_card_get_drvdata(card); 318 318 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); ··· 339 339 { 340 340 unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS; 341 341 unsigned int codec_dai_fmt = SND_SOC_DAIFMT_CBS_CFS; 342 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 342 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 343 343 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 344 344 struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); 345 345 int ret = 0;
+4 -4
sound/soc/qcom/sc8280xp.c
··· 50 50 51 51 static void sc8280xp_snd_shutdown(struct snd_pcm_substream *substream) 52 52 { 53 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 53 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 54 54 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 55 55 struct sc8280xp_snd_data *pdata = snd_soc_card_get_drvdata(rtd->card); 56 56 struct sdw_stream_runtime *sruntime = pdata->sruntime[cpu_dai->id]; ··· 89 89 static int sc8280xp_snd_hw_params(struct snd_pcm_substream *substream, 90 90 struct snd_pcm_hw_params *params) 91 91 { 92 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 92 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 93 93 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 94 94 struct sc8280xp_snd_data *pdata = snd_soc_card_get_drvdata(rtd->card); 95 95 ··· 98 98 99 99 static int sc8280xp_snd_prepare(struct snd_pcm_substream *substream) 100 100 { 101 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 101 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 102 102 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 103 103 struct sc8280xp_snd_data *data = snd_soc_card_get_drvdata(rtd->card); 104 104 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; ··· 109 109 110 110 static int sc8280xp_snd_hw_free(struct snd_pcm_substream *substream) 111 111 { 112 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 112 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 113 113 struct sc8280xp_snd_data *data = snd_soc_card_get_drvdata(rtd->card); 114 114 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 115 115 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];
+4 -4
sound/soc/qcom/sdw.c
··· 21 21 */ 22 22 int qcom_snd_sdw_startup(struct snd_pcm_substream *substream) 23 23 { 24 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 24 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 25 25 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 26 26 struct sdw_stream_runtime *sruntime; 27 27 struct snd_soc_dai *codec_dai; ··· 54 54 struct sdw_stream_runtime *sruntime, 55 55 bool *stream_prepared) 56 56 { 57 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 57 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 58 58 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 59 59 int ret; 60 60 ··· 105 105 struct snd_pcm_hw_params *params, 106 106 struct sdw_stream_runtime **psruntime) 107 107 { 108 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 108 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 109 109 struct snd_soc_dai *codec_dai; 110 110 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 111 111 struct sdw_stream_runtime *sruntime; ··· 135 135 int qcom_snd_sdw_hw_free(struct snd_pcm_substream *substream, 136 136 struct sdw_stream_runtime *sruntime, bool *stream_prepared) 137 137 { 138 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 138 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 139 139 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 140 140 141 141 switch (cpu_dai->id) {
+5 -5
sound/soc/qcom/sm8250.c
··· 50 50 { 51 51 unsigned int fmt = SND_SOC_DAIFMT_BP_FP; 52 52 unsigned int codec_dai_fmt = SND_SOC_DAIFMT_BC_FC; 53 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 53 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 54 54 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 55 55 struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); 56 56 ··· 72 72 73 73 static void sm2450_snd_shutdown(struct snd_pcm_substream *substream) 74 74 { 75 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 75 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 76 76 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 77 77 struct sm8250_snd_data *data = snd_soc_card_get_drvdata(rtd->card); 78 78 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; ··· 84 84 static int sm8250_snd_hw_params(struct snd_pcm_substream *substream, 85 85 struct snd_pcm_hw_params *params) 86 86 { 87 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 87 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 88 88 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 89 89 struct sm8250_snd_data *pdata = snd_soc_card_get_drvdata(rtd->card); 90 90 ··· 93 93 94 94 static int sm8250_snd_prepare(struct snd_pcm_substream *substream) 95 95 { 96 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 96 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 97 97 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 98 98 struct sm8250_snd_data *data = snd_soc_card_get_drvdata(rtd->card); 99 99 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; ··· 104 104 105 105 static int sm8250_snd_hw_free(struct snd_pcm_substream *substream) 106 106 { 107 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 107 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 108 108 struct sm8250_snd_data *data = snd_soc_card_get_drvdata(rtd->card); 109 109 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 110 110 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];
+4 -4
sound/soc/qcom/x1e80100.c
··· 31 31 32 32 static void x1e80100_snd_shutdown(struct snd_pcm_substream *substream) 33 33 { 34 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 34 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 35 35 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 36 36 struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card); 37 37 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; ··· 67 67 static int x1e80100_snd_hw_params(struct snd_pcm_substream *substream, 68 68 struct snd_pcm_hw_params *params) 69 69 { 70 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 70 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 71 71 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 72 72 struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card); 73 73 ··· 76 76 77 77 static int x1e80100_snd_prepare(struct snd_pcm_substream *substream) 78 78 { 79 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 79 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 80 80 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 81 81 struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card); 82 82 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; ··· 87 87 88 88 static int x1e80100_snd_hw_free(struct snd_pcm_substream *substream) 89 89 { 90 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 90 + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 91 91 struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card); 92 92 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 93 93 struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];