From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: [PATCH] ata: disable port while unloading ATA controller driver Date: Tue, 29 Nov 2016 17:29:41 -0500 Message-ID: <20161129222941.GA17732@htj.duckdns.org> References: <20161127231856.11466-1-vz@mleia.com> <20161128183425.GA19096@htj.duckdns.org> <09c7866c-ecd4-f48a-5112-6cf3c6786cd9@mleia.com> <20161129190025.GC22330@htj.duckdns.org> <20161129204413.GC4959@htj.duckdns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mail-yw0-f193.google.com ([209.85.161.193]:36598 "EHLO mail-yw0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751438AbcK2W3t (ORCPT ); Tue, 29 Nov 2016 17:29:49 -0500 Received: by mail-yw0-f193.google.com with SMTP id r204so13395760ywb.3 for ; Tue, 29 Nov 2016 14:29:49 -0800 (PST) Content-Disposition: inline In-Reply-To: Sender: linux-ide-owner@vger.kernel.org List-Id: linux-ide@vger.kernel.org To: Vladimir Zapolskiy Cc: Rob Herring , Bartlomiej Zolnierkiewicz , linux-ide@vger.kernel.org Hello, On Wed, Nov 30, 2016 at 12:15:50AM +0200, Vladimir Zapolskiy wrote: > in case if I haven't tired you out yet, I verified you solution and it > works perfectly, there is no problem in ATA subsystem which I can point > out: > > diff --git a/drivers/base/dd.c b/drivers/base/dd.c > index d76cd97..a4feecf 100644 > --- a/drivers/base/dd.c > +++ b/drivers/base/dd.c > @@ -384,6 +384,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) > if (test_remove) { > test_remove = false; > > + async_synchronize_full(); > + > if (dev->bus->remove) > dev->bus->remove(dev); > else if (drv->remove) Yeah, this should do it. > In my understanding the code under "if (test_remove)" branch should be > close to the code of __device_release_driver() function, but here it > is slightly different on purpose --- driver_allows_async_probing(drv) > returns false in case of the ATA controller driver(s), here async > probing is not a functional part of a driver, but it is embedded into > the ATA subsystem by means of generic async_port_probe(). Not sure if > __device_release_driver() or driver_allows_async_probing() should be > corrected respecting this case, and hence I'm not going to touch it. Currently, we depend on the fact that there is guaranteed to be a synchronization point before unloading, so adding that to test code seems like the right thing to do to me. Thanks. -- tejun