From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754176AbbFJXPc (ORCPT ); Wed, 10 Jun 2015 19:15:32 -0400 Received: from v094114.home.net.pl ([79.96.170.134]:65401 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751392AbbFJXPW (ORCPT ); Wed, 10 Jun 2015 19:15:22 -0400 From: "Rafael J. Wysocki" To: Andy Shevchenko Cc: linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, Greg Kroah-Hartman , Vinod Koul , Lee Jones , Andrew Morton , Mika Westerberg , linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, Heikki Krogerus , Jarkko Nikula , "Wysocki, Rafael J" , Mike Turquette Subject: Re: [PATCH v3 3/8] Driver core: wakeup the parent device before trying probe Date: Thu, 11 Jun 2015 01:41:12 +0200 Message-ID: <3084933.IUY5TMoHv9@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.1.0-rc5+; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1433929395.26331.116.camel@linux.intel.com> References: <1433170082-117462-1-git-send-email-andriy.shevchenko@linux.intel.com> <3252449.XN2pzxrAPQ@vostro.rjw.lan> <1433929395.26331.116.camel@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday, June 10, 2015 12:43:15 PM Andy Shevchenko wrote: > On Wed, 2015-06-10 at 02:08 +0200, Rafael J. Wysocki wrote: > > On Tuesday, June 09, 2015 01:42:00 AM Rafael J. Wysocki wrote: > > > On Monday, June 01, 2015 05:47:57 PM Andy Shevchenko wrote: > > > > From: Heikki Krogerus > > > > > > > > If the parent is still suspended when driver probe is > > > > attempted, the result may be failure. > > > > > > > > For example, if the parent is a PCI MFD device that has been > > > > suspended when we try to probe our device, any register > > > > reads will return 0xffffffff. > > > > > > > > To fix the problem, making sure the parent is always awake > > > > before attempting driver probe. > > > > > > > > Signed-off-by: Heikki Krogerus > > > > Signed-off-by: Andy Shevchenko > > > > --- > > > > drivers/base/dd.c | 8 ++++++++ > > > > 1 file changed, 8 insertions(+) > > > > > > > > diff --git a/drivers/base/dd.c b/drivers/base/dd.c > > > > index e843fdb..cfbeff3 100644 > > > > --- a/drivers/base/dd.c > > > > +++ b/drivers/base/dd.c > > > > @@ -399,6 +399,8 @@ EXPORT_SYMBOL_GPL(wait_for_device_probe); > > > > * > > > > * This function must be called with @dev lock held. When called for a > > > > * USB interface, @dev->parent lock must be held as well. > > > > + * > > > > + * If device has a parent it will be powered on during device's probe(). > > > > */ > > > > int driver_probe_device(struct device_driver *drv, struct device *dev) > > > > { > > > > @@ -410,10 +412,16 @@ int driver_probe_device(struct device_driver *drv, struct device *dev) > > > > pr_debug("bus: '%s': %s: matched device %s with driver %s\n", > > > > drv->bus->name, __func__, dev_name(dev), drv->name); > > > > > > > > + if (dev->parent) > > > > + pm_runtime_get_sync(dev->parent); > > > > + > > > > > > For some bus types that will resume and suspend the parent for many times in > > > a row in device_attach() until an appropriate driver is found. Would it be > > > more efficient to call it once before the bus_for_each_drv() loop in there? > > > > Actually, something like the below should work too (the bumping up of the > > parent's usage counter before the loop will keep it in the runtime-active > > state throughout the loop). > > > > Thanks for the patch! We are going to test this soon. > > By the way, can you give your Ack for patches 1 and 2 if there is no > objection? OK -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.