Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Takashi Iwai <tiwai@suse.de>,
	Linux-ALSA <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>, Simon <horms@verge.net.au>
Subject: Re: [PATCH 4/4] ASoC: soc-core: call snd_soc_remove_card() when component del
Date: Tue, 10 Feb 2015 13:28:18 +0100	[thread overview]
Message-ID: <54D9F962.60405@metafoo.de> (raw)
In-Reply-To: <87r3tya921.wl%kuninori.morimoto.gx@renesas.com>

On 02/10/2015 01:44 AM, Kuninori Morimoto wrote:
>
> Hi Lars
>
>>>> ASoC devices are organized as CPU-CARD-CODEC. Then, CPU/CODEC
>>>> are based on component structure. Now, each CARD device knows
>>>> connected component. But CARD doesn't notice if connected component
>>>> was removed when user called rmmod or unbind in current implementation.
>>>> Thus, CARD which lost some components still exist in system.
>>>> And then, ALSA sound card will have some problem if user used this CARD
>>>> in such timing. This patch temporarily removes CARD from system
>>>> if connected component was removed, and re-add it if some component
>>>> was added.
>>>>
>>>> Reported-by: Nguyen Viet Dung <nv-dung@jinso.co.jp>
>>>> Reported-by: Bui Duc Phuc <bd-phuc@jinso.co.jp>
>>>> Reported-by: Cao Minh Hiep <cm-hiep@jinso.co.jp>
>>>> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>>>> ---
> (snip)
>> The other issue is that it introduces subtly issues with the suspend and
>> resume order. Suspend and resume are called in the order in which the probe
>> functions of devices are called (and succeed). By returning -EPROBE_DEFER in
>> the card driver we make sure that the card's probe function is always called
>> after the probe functions of all the components of the card have run. This
>> again causes the card's suspend function to be called before any suspend
>> function of any of it's components. Now with this patch it is possible again
>> for a component's probe function to be called after the card's probe
>> function which changes the suspend and resume order and might break things.
>>
>> This patch essentially is a partial revert of commit b19e6e7b763 ("ASoC:
>> core: Use driver core probe deferral") where the card list was replaced with
>> the -EPROBE_DEFER mechanism.
>>
>> So while this patch fixes the nasty crash it introduces some other subtle
>> issue. Maybe we should also add a big WARN() when a component of a card is
>> removed while still in use until the other issues are also fixed.
>
> OK. I can send such patch.
> Oops ? does this mean my patch-set + WARN() ? or just WARN() ?

Both. Or an alternative would be not to allow re-binding the card and force 
the user to unbind/bind the card before it starts working again.

- Lars

  reply	other threads:[~2015-02-10 12:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09  8:51 [PATCH 0/4 v3] ASoC: rsnd: tidyup .remove method Kuninori Morimoto
2015-02-09  8:52 ` [PATCH 1/4] ASoC: soc-core: add snd_soc_remove_card() Kuninori Morimoto
2015-02-09  8:52 ` [PATCH 2/4] ASoC: soc-core: deactivate pins in snd_soc_instantiate_card() Kuninori Morimoto
2015-02-09  8:52 ` [PATCH 3/4] ASoC: soc-core: call soc_cleanup_card_debugfs() from snd_soc_unregister_card() Kuninori Morimoto
2015-02-09  8:52 ` [PATCH 4/4] ASoC: soc-core: call snd_soc_remove_card() when component del Kuninori Morimoto
2015-02-09 10:48   ` Takashi Iwai
2015-02-09 11:26     ` Lars-Peter Clausen
2015-02-09 13:07       ` Takashi Iwai
2015-02-09 13:09         ` Lars-Peter Clausen
2015-02-09 13:35           ` Takashi Iwai
2015-02-09 14:11             ` Lars-Peter Clausen
2015-02-10  0:44       ` Kuninori Morimoto
2015-02-10 12:28         ` Lars-Peter Clausen [this message]
2015-02-13  0:24           ` 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=54D9F962.60405@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=horms@verge.net.au \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=tiwai@suse.de \
    /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