All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: "Sridharan, Ranjani" <ranjani.sridharan@intel.com>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Mark Brown <broonie@kernel.org>,
	digetx@gmail.com
Subject: Re: [PATCH][RFC] ASoC: soc-component: count snd_soc_component_open/close()
Date: 20 Feb 2020 10:41:48 +0900	[thread overview]
Message-ID: <875zg2t4qd.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <CAFQqKeX8oDOUsN_=OfO7Sn_vTmdE-BbHL8Jruji_rAY85mB98g@mail.gmail.com>


Hi Sridharan

>     ASoC component open/close and snd_soc_component_module_get/put are
>     called once for each component, but we need it for each substream.
>     To solve this issue, this patch counts open / get,
>     and call close / put accordingly.
>
>     Fixes: dd03907bf129 ("ASoC: soc-pcm: call snd_soc_component_open/close() once")
>     Reported-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
>     Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>     ---
(snip)
>     @@ -297,14 +297,16 @@ EXPORT_SYMBOL_GPL(snd_soc_component_set_jack);
>      int snd_soc_component_module_get(struct snd_soc_component *component,
>                                      int upon_open)
>      {
>     -       if (component->module)
>     -               return 0;
>     +       if (unlikely(component->module == 0xff)) {
>     +               dev_warn(component->dev, "too many module get (%s)\n", component->name);
>     +               return -EBUSY;
>     +       }
>
>             if (component->driver->module_get_upon_open == !!upon_open &&
>                 !try_module_get(component->dev->driver->owner))
>                     return -ENODEV;
>
>     -       component->module = 1;
>     +       component->module++;
>
> Thanks, Morimoto-san for the alternate fix. I understand the rationale for having a count for component->opened, but what is the rationale for the module count? What it is
> intended to protect?

I think same as open ?
It protects calling put() from not-get-component.
Because module_put() has WARN_ON(ret < 0).

Thank you for your help !!
Best regards
---
Kuninori Morimoto

  reply	other threads:[~2020-02-20  1:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19 18:26 [PATCH] ASoC: soc-pcm: Revert "call snd_soc_component_open/close() once" Kai Vehmanen
2020-02-19 18:53 ` Kai Vehmanen
2020-02-19 19:27   ` Pierre-Louis Bossart
2020-02-19 19:37 ` Dmitry Osipenko
2020-02-20  0:42 ` Kuninori Morimoto
2020-02-20  0:59   ` [PATCH][RFC] ASoC: soc-component: count snd_soc_component_open/close() Kuninori Morimoto
2020-02-20  1:25     ` Sridharan, Ranjani
2020-02-20  1:41       ` Kuninori Morimoto [this message]
2020-02-20  1:57         ` Sridharan, Ranjani
2020-02-20  3:01           ` Kuninori Morimoto
2020-02-20  9:33   ` [PATCH] ASoC: soc-pcm: Revert "call snd_soc_component_open/close() once" Kai Vehmanen
2020-02-21  1:13     ` Kuninori Morimoto
2020-02-21 11:09       ` Kai Vehmanen
2020-02-25  0:41         ` Kuninori Morimoto
2020-02-26  0:55           ` Kuninori Morimoto
2020-02-26 17:36             ` Mark Brown
2020-02-27  0:11               ` Kuninori Morimoto
2020-02-27  9:41             ` Kai Vehmanen
2020-02-28  0:46               ` Kuninori Morimoto
2020-02-28  6:27                 ` Kuninori Morimoto
2020-02-28  7:57                   ` Kuninori Morimoto
2020-02-28 12:23                     ` Kai Vehmanen
2020-03-02  0:29                       ` Kuninori Morimoto
2020-03-02 18:22                         ` Kai Vehmanen
2020-03-03  0:43                           ` Kuninori Morimoto
2020-03-03 19:48                             ` Kai Vehmanen
2020-03-04  0:11                               ` 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=875zg2t4qd.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=digetx@gmail.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@intel.com \
    --cc=ranjani.sridharan@linux.intel.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.