From patchwork Mon Jun 1 14:47:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 6522671 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9EFB7C0020 for ; Mon, 1 Jun 2015 14:49:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5EB720458 for ; Mon, 1 Jun 2015 14:49:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E36B92043C for ; Mon, 1 Jun 2015 14:49:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753539AbbFAOsv (ORCPT ); Mon, 1 Jun 2015 10:48:51 -0400 Received: from mga14.intel.com ([192.55.52.115]:42334 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753521AbbFAOsn (ORCPT ); Mon, 1 Jun 2015 10:48:43 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 01 Jun 2015 07:48:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,533,1427785200"; d="scan'208";a="738750620" Received: from black.fi.intel.com ([10.237.72.86]) by orsmga002.jf.intel.com with ESMTP; 01 Jun 2015 07:48:36 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id A1D9C585; Mon, 1 Jun 2015 17:48:05 +0300 (EEST) From: Andy Shevchenko To: "Rafael J . Wysocki" , 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 Cc: Andy Shevchenko Subject: [PATCH v3 3/8] Driver core: wakeup the parent device before trying probe Date: Mon, 1 Jun 2015 17:47:57 +0300 Message-Id: <1433170082-117462-4-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1433170082-117462-1-git-send-email-andriy.shevchenko@linux.intel.com> References: <1433170082-117462-1-git-send-email-andriy.shevchenko@linux.intel.com> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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); + pm_runtime_barrier(dev); ret = really_probe(dev, drv); pm_request_idle(dev); + if (dev->parent) + pm_runtime_put_sync(dev->parent); + return ret; }