[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <AM0PR04MB6468D4D15E471940B1906344E3780@AM0PR04MB6468.eurprd04.prod.outlook.com>
Date: Thu, 7 Nov 2019 06:54:16 +0000
From: "S.j. Wang" <shengjiu.wang@....com>
To: Daniel Baluta <daniel.baluta@...il.com>
CC: Timur Tabi <timur@...nel.org>,
Nicolin Chen <nicoleotsuka@...il.com>,
Xiubo Li <Xiubo.Lee@...il.com>,
Fabio Estevam <festevam@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Linux-ALSA <alsa-devel@...a-project.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [alsa-devel] [PATCH] ASoC: fsl_audmix: Add spin lock to protect
tdms
Hi
>
> Hi Shengjiu,
>
> Comments inline.
>
> On Wed, Nov 6, 2019 at 9:30 AM Shengjiu Wang <shengjiu.wang@....com>
> wrote:
> >
> > Audmix support two substream, When two substream start to run, the
> > trigger function may be called by two substream in same time, that the
> > priv->tdms may be updated wrongly.
> >
> > The expected priv->tdms is 0x3, but sometimes the result is 0x2, or
> > 0x1.
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@....com>
> > ---
> > sound/soc/fsl/fsl_audmix.c | 6 ++++++ sound/soc/fsl/fsl_audmix.h | 1
> > +
> > 2 files changed, 7 insertions(+)
> >
> > diff --git a/sound/soc/fsl/fsl_audmix.c b/sound/soc/fsl/fsl_audmix.c
> > index c7e4e9757dce..a1db1bce330f 100644
> > --- a/sound/soc/fsl/fsl_audmix.c
> > +++ b/sound/soc/fsl/fsl_audmix.c
> > @@ -286,6 +286,7 @@ static int fsl_audmix_dai_trigger(struct
> snd_pcm_substream *substream, int cmd,
> > struct snd_soc_dai *dai) {
> > struct fsl_audmix *priv = snd_soc_dai_get_drvdata(dai);
> > + unsigned long lock_flags;
> >
> > /* Capture stream shall not be handled */
> > if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
> > @@ -295,12 +296,16 @@ static int fsl_audmix_dai_trigger(struct
> snd_pcm_substream *substream, int cmd,
> > case SNDRV_PCM_TRIGGER_START:
> > case SNDRV_PCM_TRIGGER_RESUME:
> > case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
> > + spin_lock_irqsave(&priv->lock, lock_flags);
>
> Why do we need to disable interrupts here? I assume that lock is only
> used in process context.
>
It is in atomic context, so I think it is ok to disable interrupt.
Best regards
Wang shengjiu
Powered by blists - more mailing lists