From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:35821 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932340AbdCaHsF (ORCPT ); Fri, 31 Mar 2017 03:48:05 -0400 Date: Fri, 31 Mar 2017 09:48:02 +0200 Message-ID: From: Takashi Iwai To: Mark Brown Cc: Kuninori Morimoto , Linux-Renesas , Linux-ALSA , Lars-Peter , Simon Subject: Re: [alsa-devel] [RFC][PATCH] ASoC: soc-core: verify Sound Card normality In-Reply-To: <20170330215334.zwashvjerpfnkk3u@sirena.org.uk> References: <87vaqsajo0.wl%kuninori.morimoto.gx@renesas.com> <20170330215334.zwashvjerpfnkk3u@sirena.org.uk> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-renesas-soc-owner@vger.kernel.org List-ID: On Thu, 30 Mar 2017 23:53:34 +0200, Mark Brown wrote: > > On Wed, Mar 29, 2017 at 02:45:37AM +0000, Kuninori Morimoto wrote: > > > To avoid Sound Card crash in (2) case, what we can do now is, add dirty > > flag on Sound Card, and avoid to open Sound Card. > > This patch solved this issue. > > I think this is a good direction to at least start to mitigate these > problems (which we really should be doing) and hopefully make it easier > to do further improvements in future. There's obviously more places > where we should be checking the flag (controls for example) but they can > be added later. One thing I would like to see is instead of setting the > flag directly when we see a problem call a function to do it. That way > if we want to improve things in the future we can do that without having > to update the callers again. BTW, ALSA core has snd_card_disconnect() that does this kind of shut-up from user-space. It was introduced for hot-unplug, but basically unbinding is the software hot-unplug. So, if ASoC won't rebind a once-unbound component, you can simply call snd_card_disconnect() at the component unbinding time to assure that no further user actions can be done. Takashi