From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:57706 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754030AbcHDNw3 (ORCPT ); Thu, 4 Aug 2016 09:52:29 -0400 Date: Thu, 04 Aug 2016 15:52:24 +0200 Message-ID: From: Takashi Iwai To: Takashi Sakamoto Cc: Mark Brown , Linux-ALSA , Lars-Peter Clausen , Kuninori Morimoto , Liam Girdwood , linux-renesas-soc@vger.kernel.org, Vinod Koul , Simon Subject: Re: Question about struct snd_soc_dai() :: cpu_dai->codec In-Reply-To: <30173e35-41fc-36f2-4c31-f51f753cb34b@sakamocchi.jp> References: <20160728034643.GH9681@localhost> <579A6C1B.2060904@metafoo.de> <579AA39B.5030100@sakamocchi.jp> <884bd15f-da5e-49f5-73ee-d8173dc0720a@metafoo.de> <20160729160702.GK9681@localhost> <20160729220854.GN10376@sirena.org.uk> <5152607b-90ab-1675-6be8-986be880a8eb@sakamocchi.jp> <20160804102826.GU10376@sirena.org.uk> <30173e35-41fc-36f2-4c31-f51f753cb34b@sakamocchi.jp> 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, 04 Aug 2016 15:39:40 +0200, Takashi Sakamoto wrote: > > On Aug 4 2016 21:27, Takashi Iwai wrote: > > On Thu, 04 Aug 2016 14:12:09 +0200, > > Takashi Sakamoto wrote: > >> > >> On Aug 4 2016 19:28, Mark Brown wrote: > >>> On Thu, Aug 04, 2016 at 12:17:57PM +0900, Takashi Sakamoto wrote: > >>>> On Jul 30 2016 07:08, Mark Brown wrote: > >>> > >>>>> The card should be deinstantiated and reinstantiated whenever a > >>>>> component driver unbinds and rebinds (respectively). You'd need to > >>>>> completely deregister the card to change the list of things it's > >>>>> expecting currently. > >>> > >>>> In a point of application interfaces, I guess that current implementation of > >>>> ALSA soc part includes a bug that it's possible to unload codec or component > >>>> modules when any ALSA character devices are opened. The framework has no > >>>> codes to manage reference counting of character devices or loaded codecs, > >>>> components. > >>> > >>> Yes, exactly - we don't cope very well with that situation and we really > >>> ought to but since it's hard to trigger without trying in practice it's > >>> never been a priority. > >> > >> Ugly... completely ugly idea for user space applications and operating > >> system... It's better for developers for ALSA soc part to pay enough > >> attention not only to their hardwares but also to application interfaces. > >> > >> Please assume that a loaded module for SoC's sound interface which > >> supports Jack detection, and pulseaudio runs on the system. Then, > >> typically, the process listen to ALSA ctrl character device for Jack > >> detection. > >> > >> In this case, when modules for codec or component are unloaded, what > >> happends? > > > > You can't unload. The module unload is already protected by the > > proper module refcounting. > > Hm. For my information, could you please show call graph to increment > the reference counter of codec/component modules when modules for SoC's > sound interfaces refer to them? Just grep try_module_get() and module_put() calls. Takashi