Skip to content

Commit 410a451

Browse files
krzkbroonie
authored andcommitted
ASoC: mediatek: Use snd_soc_substream_to_rtd() for accessing private_data
Do not open-code snd_soc_substream_to_rtd(). Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent ffad75c commit 410a451

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

sound/soc/mediatek/mt7986/mt7986-afe-pcm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static const struct snd_pcm_hardware mt7986_afe_hardware = {
106106
static int mt7986_memif_fs(struct snd_pcm_substream *substream,
107107
unsigned int rate)
108108
{
109-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
109+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
110110
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
111111
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
112112

@@ -116,7 +116,7 @@ static int mt7986_memif_fs(struct snd_pcm_substream *substream,
116116
static int mt7986_irq_fs(struct snd_pcm_substream *substream,
117117
unsigned int rate)
118118
{
119-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
119+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
120120
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
121121
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
122122

sound/soc/mediatek/mt8186/mt8186-afe-pcm.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static const struct snd_pcm_hardware mt8186_afe_hardware = {
4040
static int mt8186_fe_startup(struct snd_pcm_substream *substream,
4141
struct snd_soc_dai *dai)
4242
{
43-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
43+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
4444
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
4545
struct snd_pcm_runtime *runtime = substream->runtime;
4646
int id = snd_soc_rtd_to_cpu(rtd, 0)->id;
@@ -82,7 +82,7 @@ static int mt8186_fe_startup(struct snd_pcm_substream *substream,
8282
static void mt8186_fe_shutdown(struct snd_pcm_substream *substream,
8383
struct snd_soc_dai *dai)
8484
{
85-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
85+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
8686
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
8787
struct mt8186_afe_private *afe_priv = afe->platform_priv;
8888
int id = snd_soc_rtd_to_cpu(rtd, 0)->id;
@@ -104,7 +104,7 @@ static int mt8186_fe_hw_params(struct snd_pcm_substream *substream,
104104
struct snd_pcm_hw_params *params,
105105
struct snd_soc_dai *dai)
106106
{
107-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
107+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
108108
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
109109
int id = snd_soc_rtd_to_cpu(rtd, 0)->id;
110110
unsigned int channels = params_channels(params);
@@ -153,7 +153,7 @@ static int mt8186_fe_hw_free(struct snd_pcm_substream *substream,
153153
static int mt8186_fe_trigger(struct snd_pcm_substream *substream, int cmd,
154154
struct snd_soc_dai *dai)
155155
{
156-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
156+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
157157
struct snd_pcm_runtime * const runtime = substream->runtime;
158158
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
159159
struct mt8186_afe_private *afe_priv = afe->platform_priv;
@@ -252,7 +252,7 @@ static int mt8186_fe_trigger(struct snd_pcm_substream *substream, int cmd,
252252
static int mt8186_memif_fs(struct snd_pcm_substream *substream,
253253
unsigned int rate)
254254
{
255-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
255+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
256256
struct snd_soc_component *component =
257257
snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
258258
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
@@ -269,7 +269,7 @@ static int mt8186_get_dai_fs(struct mtk_base_afe *afe,
269269

270270
static int mt8186_irq_fs(struct snd_pcm_substream *substream, unsigned int rate)
271271
{
272-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
272+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
273273
struct snd_soc_component *component =
274274
snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
275275
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
@@ -290,7 +290,7 @@ static int mt8186_get_memif_pbuf_size(struct snd_pcm_substream *substream)
290290
static int mt8186_fe_prepare(struct snd_pcm_substream *substream,
291291
struct snd_soc_dai *dai)
292292
{
293-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
293+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
294294
struct snd_pcm_runtime * const runtime = substream->runtime;
295295
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
296296
int id = snd_soc_rtd_to_cpu(rtd, 0)->id;

sound/soc/mediatek/mt8186/mt8186-mt6366.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static const struct snd_soc_ops mt8186_da7219_i2s_ops = {
297297
static int mt8186_rt5682s_i2s_hw_params(struct snd_pcm_substream *substream,
298298
struct snd_pcm_hw_params *params)
299299
{
300-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
300+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
301301
struct snd_soc_card *card = rtd->card;
302302
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
303303
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);

sound/soc/mediatek/mt8188/mt8188-afe-pcm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int mt8188_afe_fs_timing(unsigned int rate)
9191
static int mt8188_memif_fs(struct snd_pcm_substream *substream,
9292
unsigned int rate)
9393
{
94-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
94+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
9595
struct snd_soc_component *component = NULL;
9696
struct mtk_base_afe *afe = NULL;
9797
struct mt8188_afe_private *afe_priv = NULL;
@@ -300,7 +300,7 @@ static int mt8188_afe_enable_cm(struct mtk_base_afe *afe,
300300
static int mt8188_afe_fe_startup(struct snd_pcm_substream *substream,
301301
struct snd_soc_dai *dai)
302302
{
303-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
303+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
304304
struct snd_pcm_runtime *runtime = substream->runtime;
305305
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
306306
int id = snd_soc_rtd_to_cpu(rtd, 0)->id;
@@ -334,7 +334,7 @@ static int mt8188_afe_fe_hw_params(struct snd_pcm_substream *substream,
334334
struct snd_pcm_hw_params *params,
335335
struct snd_soc_dai *dai)
336336
{
337-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
337+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
338338
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
339339
int id = snd_soc_rtd_to_cpu(rtd, 0)->id;
340340
struct mtk_base_afe_memif *memif = &afe->memif[id];
@@ -358,7 +358,7 @@ static int mt8188_afe_fe_trigger(struct snd_pcm_substream *substream, int cmd,
358358
{
359359
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
360360
const struct mt8188_afe_channel_merge *cm = mt8188_afe_found_cm(dai);
361-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
361+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
362362
struct snd_pcm_runtime * const runtime = substream->runtime;
363363
int id = snd_soc_rtd_to_cpu(rtd, 0)->id;
364364
struct mtk_base_afe_memif *memif = &afe->memif[id];

sound/soc/mediatek/mt8188/mt8188-mt6359.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ enum {
557557
static int mt8188_dptx_hw_params(struct snd_pcm_substream *substream,
558558
struct snd_pcm_hw_params *params)
559559
{
560-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
560+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
561561
unsigned int rate = params_rate(params);
562562
unsigned int mclk_fs_ratio = 256;
563563
unsigned int mclk_fs = rate * mclk_fs_ratio;
@@ -658,7 +658,7 @@ static int mt8188_dumb_amp_init(struct snd_soc_pcm_runtime *rtd)
658658
static int mt8188_max98390_hw_params(struct snd_pcm_substream *substream,
659659
struct snd_pcm_hw_params *params)
660660
{
661-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
661+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
662662
unsigned int bit_width = params_width(params);
663663
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
664664
struct snd_soc_dai *codec_dai;
@@ -821,7 +821,7 @@ static const struct snd_soc_ops mt8188_nau8825_ops = {
821821
static int mt8188_rt5682s_i2s_hw_params(struct snd_pcm_substream *substream,
822822
struct snd_pcm_hw_params *params)
823823
{
824-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
824+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
825825
struct snd_soc_card *card = rtd->card;
826826
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
827827
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);

sound/soc/mediatek/mt8195/mt8195-afe-pcm.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ int mt8195_afe_fs_timing(unsigned int rate)
8484
static int mt8195_memif_fs(struct snd_pcm_substream *substream,
8585
unsigned int rate)
8686
{
87-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
87+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
8888
struct snd_soc_component *component =
8989
snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
9090
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
@@ -281,7 +281,7 @@ mt8195_afe_paired_memif_clk_prepare(struct snd_pcm_substream *substream,
281281
struct snd_soc_dai *dai,
282282
int enable)
283283
{
284-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
284+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
285285
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
286286
struct mt8195_afe_private *afe_priv = afe->platform_priv;
287287
int id = snd_soc_rtd_to_cpu(rtd, 0)->id;
@@ -310,7 +310,7 @@ mt8195_afe_paired_memif_clk_enable(struct snd_pcm_substream *substream,
310310
struct snd_soc_dai *dai,
311311
int enable)
312312
{
313-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
313+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
314314
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
315315
struct mt8195_afe_private *afe_priv = afe->platform_priv;
316316
int id = snd_soc_rtd_to_cpu(rtd, 0)->id;
@@ -342,7 +342,7 @@ mt8195_afe_paired_memif_clk_enable(struct snd_pcm_substream *substream,
342342
static int mt8195_afe_fe_startup(struct snd_pcm_substream *substream,
343343
struct snd_soc_dai *dai)
344344
{
345-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
345+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
346346
struct snd_pcm_runtime *runtime = substream->runtime;
347347
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
348348
int id = snd_soc_rtd_to_cpu(rtd, 0)->id;
@@ -380,7 +380,7 @@ static int mt8195_afe_fe_hw_params(struct snd_pcm_substream *substream,
380380
struct snd_pcm_hw_params *params,
381381
struct snd_soc_dai *dai)
382382
{
383-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
383+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
384384
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
385385
int id = snd_soc_rtd_to_cpu(rtd, 0)->id;
386386
struct mtk_base_afe_memif *memif = &afe->memif[id];

sound/soc/mediatek/mt8195/mt8195-mt6359.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ static const struct snd_soc_ops mt8195_hdmitx_dptx_playback_ops = {
338338
static int mt8195_dptx_hw_params(struct snd_pcm_substream *substream,
339339
struct snd_pcm_hw_params *params)
340340
{
341-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
341+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
342342
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
343343

344344
return snd_soc_dai_set_sysclk(cpu_dai, 0, params_rate(params) * 256,
@@ -394,7 +394,7 @@ static int mt8195_dptx_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
394394
static int mt8195_rt5682_etdm_hw_params(struct snd_pcm_substream *substream,
395395
struct snd_pcm_hw_params *params)
396396
{
397-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
397+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
398398
struct snd_soc_card *card = rtd->card;
399399
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
400400
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);

0 commit comments

Comments
 (0)