From: Peter Ujfalusi Date: Mon, 9 May 2016 10:39:14 +0000 (+0300) Subject: ASoC: davinci-mcasp: Do not allow multiple streams in one direction X-Git-Tag: v5.15~13488^2~7^2~2^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=19357366633cfc53532b587180af3655f0e453f3;p=platform%2Fkernel%2Flinux-starfive.git ASoC: davinci-mcasp: Do not allow multiple streams in one direction Make sure that the user can not start multiple streams with the same direction. Signed-off-by: Peter Ujfalusi Signed-off-by: Mark Brown --- diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index e132498..020d866 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1230,11 +1230,15 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, int i, dir; int tdm_slots = mcasp->tdm_slots; - if (mcasp->tdm_mask[substream->stream]) - tdm_slots = hweight32(mcasp->tdm_mask[substream->stream]); + /* Do not allow more then one stream per direction */ + if (mcasp->substreams[substream->stream]) + return -EBUSY; mcasp->substreams[substream->stream] = substream; + if (mcasp->tdm_mask[substream->stream]) + tdm_slots = hweight32(mcasp->tdm_mask[substream->stream]); + if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE) return 0;