alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Baluta <daniel.baluta@gmail.com>
To: "S.j. Wang" <shengjiu.wang@nxp.com>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Timur Tabi <timur@kernel.org>, Xiubo Li <Xiubo.Lee@gmail.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	Takashi Iwai <tiwai@suse.com>,
	Nicolin Chen <nicoleotsuka@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Fabio Estevam <festevam@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [alsa-devel] [PATCH] ASoC: fsl_audmix: Add spin lock to protect tdms
Date: Mon, 11 Nov 2019 14:59:49 +0200	[thread overview]
Message-ID: <CAEnQRZBfOCH-R-QmY2gB5jEehea1Cn+RnyOkOhMj8=ZJoOADBg@mail.gmail.com> (raw)
In-Reply-To: <AM0PR04MB6468D4D15E471940B1906344E3780@AM0PR04MB6468.eurprd04.prod.outlook.com>

On Thu, Nov 7, 2019 at 8:54 AM S.j. Wang <shengjiu.wang@nxp.com> wrote:
>
> Hi
> >
> > Hi Shengjiu,
> >
> > Comments inline.
> >
> > On Wed, Nov 6, 2019 at 9:30 AM Shengjiu Wang <shengjiu.wang@nxp.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@nxp.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.

All right thanks for the explanation. Added my Reviewed-by to v2.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2019-11-11 13:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07  6:54 [alsa-devel] [PATCH] ASoC: fsl_audmix: Add spin lock to protect tdms S.j. Wang
2019-11-11 12:59 ` Daniel Baluta [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-11-06  7:27 Shengjiu Wang
2019-11-06 11:36 ` Daniel Baluta
2019-11-09  2:45 ` Nicolin Chen
2019-11-11  7:37   ` Shengjiu Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEnQRZBfOCH-R-QmY2gB5jEehea1Cn+RnyOkOhMj8=ZJoOADBg@mail.gmail.com' \
    --to=daniel.baluta@gmail.com \
    --cc=Xiubo.Lee@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=festevam@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=nicoleotsuka@gmail.com \
    --cc=shengjiu.wang@nxp.com \
    --cc=timur@kernel.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).