All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: Re: Question about DPCM locking
Date: Mon, 25 Jul 2022 16:42:50 +0200	[thread overview]
Message-ID: <87ilnlb6dx.wl-tiwai@suse.de> (raw)
In-Reply-To: <875ykmx0vt.wl-kuninori.morimoto.gx@renesas.com>

On Mon, 27 Jun 2022 05:04:38 +0200,
Kuninori Morimoto wrote:
> 
> 
> Hi Takashi
> 
> May I ask about this patch ?
> 
> 	ASoC: soc-pcm: Fix and cleanup DPCM locking
> 	b7898396f4bbe160f546d0c5e9fa17cca9a7d153

Sorry for the very late response.  It's been completely overlooked.

> Q1.
> 
> It exchanges many function parameters
> 
> 	- func(substream, xxx)
> 	+ func(rtd, substream, xxx)
> 	       ^^^^
> 
> I guess the purpose is it want to call snd_soc_dpcm_mutex_assert_held()
> inside the func ? But it looks very verbose.
> we can do like this, but am I misunderstanding ?
> 
> 	func(substream, xxx) {
> 		struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
> 
> 		snd_soc_dpcm_mutex_assert_held(rtd);
> 
> 		...
> 	}

This could be changed in that way, too.
I just took the current code as the compiler produced a bit better
code.

> Q2.
> 
> It added new __soc_pcm_close().
> But soc_pcm_close() is using soc_pcm_clean() instead of __soc_pcm_close().
> Is this just a mistake ?
> 
> 	static int soc_pcm_close(struct snd_pcm_substream *substream)
> 	{
> 		struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
> 
> 		snd_soc_dpcm_mutex_lock(rtd);
> -		soc_pcm_clean(substream, 0);
> +		__soc_pcm_close(substream);
> 		snd_soc_dpcm_mutex_unlock(rtd);
> 		return 0;
> 	}

Not really a mistake, as you can see, that's the very same code :)
That said, it's fine to call __soc_pcm_close() there instead of the
open code, too, as long as the resultant binary becomes same (or
better).


thanks,

Takashi

  reply	other threads:[~2022-07-25 14:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27  3:04 Question about DPCM locking Kuninori Morimoto
2022-07-25 14:42 ` Takashi Iwai [this message]
2022-07-25 23:30   ` Kuninori Morimoto

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=87ilnlb6dx.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=kuninori.morimoto.gx@renesas.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.