Skip to content

Commit d98b071

Browse files
committed
ASoC: Use snd_soc_substream_to_rtd() for accessing
Merge series from Krzysztof Kozlowski <[email protected]>: Do not open-code snd_soc_substream_to_rtd() when accessing snd_pcm_substream->private_data. This makes code more consistent with rest of ASoC and allows in the future to move the field to any other place or add additional checks in snd_soc_substream_to_rtd().
2 parents ba04ff2 + 47aa516 commit d98b071

35 files changed

+82
-82
lines changed

sound/arm/pxa2xx-pcm-lib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
3333
struct snd_pcm_hw_params *params)
3434
{
3535
struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream);
36-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
36+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
3737
struct snd_dmaengine_dai_dma_data *dma_params;
3838
struct dma_slave_config config;
3939
int ret;
@@ -79,7 +79,7 @@ EXPORT_SYMBOL(pxa2xx_pcm_prepare);
7979

8080
int pxa2xx_pcm_open(struct snd_pcm_substream *substream)
8181
{
82-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
82+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
8383
struct snd_pcm_runtime *runtime = substream->runtime;
8484
struct snd_dmaengine_dai_dma_data *dma_params;
8585
int ret;

sound/soc/amd/acp/acp-mach-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static void acp_card_shutdown(struct snd_pcm_substream *substream)
217217
static int acp_card_rt5682_hw_params(struct snd_pcm_substream *substream,
218218
struct snd_pcm_hw_params *params)
219219
{
220-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
220+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
221221
struct snd_soc_card *card = rtd->card;
222222
struct acp_card_drvdata *drvdata = card->drvdata;
223223
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);

sound/soc/amd/acp3x-rt5682-max9836.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static int rt5682_clk_enable(struct snd_pcm_substream *substream)
143143
static int acp3x_1015_hw_params(struct snd_pcm_substream *substream,
144144
struct snd_pcm_hw_params *params)
145145
{
146-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
146+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
147147
struct snd_soc_dai *codec_dai;
148148
int srate, i, ret;
149149

sound/soc/amd/ps/ps-sdw-dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static int acp63_sdw_dma_open(struct snd_soc_component *component,
218218
struct acp_sdw_dma_stream *stream;
219219
struct snd_soc_dai *cpu_dai;
220220
struct amd_sdw_manager *amd_manager;
221-
struct snd_soc_pcm_runtime *prtd = substream->private_data;
221+
struct snd_soc_pcm_runtime *prtd = snd_soc_substream_to_rtd(substream);
222222
int ret;
223223

224224
runtime = substream->runtime;

sound/soc/fsl/fsl-asoc-card.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream,
242242

243243
static int fsl_asoc_card_hw_free(struct snd_pcm_substream *substream)
244244
{
245-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
245+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
246246
struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
247247
struct codec_priv *codec_priv = &priv->codec_priv;
248248
struct device *dev = rtd->card->dev;

sound/soc/fsl/imx-card.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ static unsigned long akcodec_get_mclk_rate(struct snd_pcm_substream *substream,
252252
struct snd_pcm_hw_params *params,
253253
int slots, int slot_width)
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 imx_card_data *data = snd_soc_card_get_drvdata(rtd->card);
257257
const struct imx_card_plat_data *plat_data = data->plat_data;
258258
struct dai_link_data *link_data = &data->link_data[rtd->num];
@@ -289,7 +289,7 @@ static unsigned long akcodec_get_mclk_rate(struct snd_pcm_substream *substream,
289289
static int imx_aif_hw_params(struct snd_pcm_substream *substream,
290290
struct snd_pcm_hw_params *params)
291291
{
292-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
292+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
293293
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
294294
struct snd_soc_card *card = rtd->card;
295295
struct imx_card_data *data = snd_soc_card_get_drvdata(card);
@@ -405,7 +405,7 @@ static int ak5558_hw_rule_rate(struct snd_pcm_hw_params *p, struct snd_pcm_hw_ru
405405
static int imx_aif_startup(struct snd_pcm_substream *substream)
406406
{
407407
struct snd_pcm_runtime *runtime = substream->runtime;
408-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
408+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
409409
struct snd_soc_card *card = rtd->card;
410410
struct imx_card_data *data = snd_soc_card_get_drvdata(card);
411411
struct dai_link_data *link_data = &data->link_data[rtd->num];

sound/soc/fsl/imx-hdmi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct imx_hdmi_data {
3232
static int imx_hdmi_hw_params(struct snd_pcm_substream *substream,
3333
struct snd_pcm_hw_params *params)
3434
{
35-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
35+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
3636
struct imx_hdmi_data *data = snd_soc_card_get_drvdata(rtd->card);
3737
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
3838
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);

sound/soc/fsl/imx-pcm-rpmsg.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ static int imx_rpmsg_pcm_prepare(struct snd_soc_component *component,
316316
struct snd_pcm_substream *substream)
317317
{
318318
struct snd_pcm_runtime *runtime = substream->runtime;
319-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
319+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
320320
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
321321
struct fsl_rpmsg *rpmsg = dev_get_drvdata(cpu_dai->dev);
322322

@@ -461,7 +461,7 @@ static int imx_rpmsg_pcm_trigger(struct snd_soc_component *component,
461461
struct snd_pcm_substream *substream, int cmd)
462462
{
463463
struct snd_pcm_runtime *runtime = substream->runtime;
464-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
464+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
465465
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
466466
struct fsl_rpmsg *rpmsg = dev_get_drvdata(cpu_dai->dev);
467467
int ret = 0;
@@ -515,7 +515,7 @@ static int imx_rpmsg_pcm_ack(struct snd_soc_component *component,
515515
struct snd_pcm_substream *substream)
516516
{
517517
struct snd_pcm_runtime *runtime = substream->runtime;
518-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
518+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
519519
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
520520
struct fsl_rpmsg *rpmsg = dev_get_drvdata(cpu_dai->dev);
521521
struct rpmsg_info *info = dev_get_drvdata(component->dev);

sound/soc/img/img-i2s-in.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ static int img_i2s_in_dma_prepare_slave_config(struct snd_pcm_substream *st,
395395
struct snd_pcm_hw_params *params, struct dma_slave_config *sc)
396396
{
397397
unsigned int i2s_channels = params_channels(params) / 2;
398-
struct snd_soc_pcm_runtime *rtd = st->private_data;
398+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(st);
399399
struct snd_dmaengine_dai_dma_data *dma_data;
400400
int ret;
401401

sound/soc/img/img-i2s-out.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ static int img_i2s_out_dma_prepare_slave_config(struct snd_pcm_substream *st,
401401
struct snd_pcm_hw_params *params, struct dma_slave_config *sc)
402402
{
403403
unsigned int i2s_channels = params_channels(params) / 2;
404-
struct snd_soc_pcm_runtime *rtd = st->private_data;
404+
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(st);
405405
struct snd_dmaengine_dai_dma_data *dma_data;
406406
int ret;
407407

0 commit comments

Comments
 (0)