Skip to content

Commit

Permalink
ASoC/mpc5200: add to_psc_dma_stream() helper
Browse files Browse the repository at this point in the history
Move the resolving of the psc_dma_stream pointer to a helper function
to reduce duplicate code

Signed-off-by: Grant Likely <[email protected]>
Acked-by: Liam Girdwood <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
glikely authored and broonie committed Nov 7, 2009
1 parent c487827 commit 1d8222e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 1 addition & 6 deletions sound/soc/fsl/mpc5200_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,12 @@ static int psc_dma_trigger(struct snd_pcm_substream *substream, int cmd)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data;
struct snd_pcm_runtime *runtime = substream->runtime;
struct psc_dma_stream *s;
struct psc_dma_stream *s = to_psc_dma_stream(substream, psc_dma);
struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;
u16 imr;
unsigned long flags;
int i;

if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
s = &psc_dma->capture;
else
s = &psc_dma->playback;

switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
dev_dbg(psc_dma->dev, "START: stream=%i fbits=%u ps=%u #p=%u\n",
Expand Down
9 changes: 9 additions & 0 deletions sound/soc/fsl/mpc5200_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ struct psc_dma {
} stats;
};

/* Utility for retrieving psc_dma_stream structure from a substream */
inline struct psc_dma_stream *
to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma *psc_dma)
{
if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
return &psc_dma->capture;
return &psc_dma->playback;
}

int mpc5200_audio_dma_create(struct of_device *op);
int mpc5200_audio_dma_destroy(struct of_device *op);

Expand Down

0 comments on commit 1d8222e

Please sign in to comment.