From: Takashi Iwai Subject: Re: [PATCH] fm801: move to pcim_* and devm_* functions Date: Tue, 20 Jan 2015 13:42:23 +0100 Message-ID: References: <1420587617-28521-1-git-send-email-andy.shevchenko@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 1035F260489 for ; Tue, 20 Jan 2015 13:42:24 +0100 (CET) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Andy Shevchenko Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Wed, 07 Jan 2015 15:59:35 +0100, Takashi Iwai wrote: > > At Wed, 7 Jan 2015 16:25:22 +0200, > Andy Shevchenko wrote: > > > > On Wed, Jan 7, 2015 at 3:57 PM, Takashi Iwai wrote: > > > At Wed, 07 Jan 2015 14:43:41 +0100, > > > Takashi Iwai wrote: > > >> > > >> At Wed, 7 Jan 2015 15:40:26 +0200, > > >> Andy Shevchenko wrote: > > >> > > > >> > On Wed, Jan 7, 2015 at 3:31 PM, Takashi Iwai wrote: > > >> > > At Wed, 7 Jan 2015 15:27:35 +0200, > > >> > > Andy Shevchenko wrote: > > >> > > > >> > Regarding to the original patch, is it okay now to apply? > > >> > > >> Yes. If you prefer, I can apply it first alone. > > > > Why not? :) > > > > > > > > OK, I found that the regions are released in pcim_release(). So, > > > there is no leak. > > > > > > Meanwhile it means that pci_release_regions() is superfluous, too, > > > once when you enabled the managed mode via pcim_enable_device(). > > > Could you resubmit a v2 patch with that removal? > > > > Within few hours together with the second patch. But if you can do > > this as a fixup it would be nice. > > OK, now applied this patch with a modification (removal of > pci_release_regions()) to for-next branch. I recalled finally why I didn't want this sort of changes. Namely, devm_request_irq() can't be used safely for the shared PCI interrupts. There is a small open window between the driver's remove call (i.e. card's private_free or device free calls) and the call of devres_release_all(). The registered irq handler still remains during this window. When an irq is triggered from another shared device during this, it goes to the remaining irq handler and accesses the hardware unexpectedly. In the case of snd_fm801_interrupt(), it's not too bad, though. Takashi