From patchwork Mon Oct 13 14:02:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 5076551 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D75309F387 for ; Mon, 13 Oct 2014 14:02:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EAB3A20212 for ; Mon, 13 Oct 2014 14:02:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 28742201F5 for ; Mon, 13 Oct 2014 14:02:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754135AbaJMOCl (ORCPT ); Mon, 13 Oct 2014 10:02:41 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:43750 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754089AbaJMOCj (ORCPT ); Mon, 13 Oct 2014 10:02:39 -0400 Received: by mail-wi0-f179.google.com with SMTP id d1so7563345wiv.0 for ; Mon, 13 Oct 2014 07:02:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9gQj+IYnG6Pm8hQoZ2+Cy0C5oIiSK4LPGi0NYJaSy3M=; b=lc7sPjtGu16LbWqeqLvG/vmuKHDKMx/TAst7OegLJUE9lemk2+I5CiUXSHDs7oVIFb liyis6at2wikFe6GRIYrPWz7da4bOhblE7p5TD4klBM1dYhswPE0VXQNnTFRwbr1Emd/ iCbvxlsxquYWk1U4WyWlKjMbc1/13nYFN5TXOX7rArEX2pWVkQqXqzXZLOXsWnn9ErdY iodRPGicikNEWn0MIIARP3i6mUegvaTpH0LMWWGel9Or28WzYVV66KH4EBI0dSWVHOxP zXEw8xAKDRNMKhi4Ym2oPfMuFDW65XdBPZPaK8AeDbMewgSL8pWG+g1il68sGf9h8292 Yhsg== X-Gm-Message-State: ALoCoQnlxIJYAy6Y52UPKpTlHNsTmdHqHqsMrQQfMsE+QeXugOFyqa29dRDl9ZUM0Kuk8ekuhB5t X-Received: by 10.180.97.199 with SMTP id ec7mr944335wib.29.1413208957936; Mon, 13 Oct 2014 07:02:37 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id fq1sm1533474wib.12.2014.10.13.07.02.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Oct 2014 07:02:37 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Geert Uytterhoeven , Kevin Hilman , Alan Stern , Greg Kroah-Hartman , Tomasz Figa , Simon Horman , Magnus Damm , Ben Dooks , Kukjin Kim , Philipp Zabel , Mark Brown , Wolfram Sang , Russell King , Dmitry Torokhov , Jack Dai , Jinkun Hong , Aaron Lu , Sylwester Nawrocki , Ulf Hansson Subject: [PATCH v3 4/9] drivercore / platform: Keep PM domain powered during ->probe() Date: Mon, 13 Oct 2014 16:02:05 +0200 Message-Id: <1413208930-26019-5-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413208930-26019-1-git-send-email-ulf.hansson@linaro.org> References: <1413208930-26019-1-git-send-email-ulf.hansson@linaro.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@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=ham 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 To sucessfully probe some devices their corresponding PM domains may need to be powered. Use the dev_pm_domain_get|put() APIs, to control the behavior of the PM domain. Signed-off-by: Ulf Hansson --- drivers/base/platform.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index b2afc29..43897ad 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -509,7 +509,14 @@ static int platform_drv_probe(struct device *_dev) ret = dev_pm_domain_attach(_dev, true); if (ret != -EPROBE_DEFER) { + ret = dev_pm_domain_get(_dev->pm_domain); + if (ret) { + dev_pm_domain_detach(_dev, true); + return ret; + } + ret = drv->probe(dev); + dev_pm_domain_put(_dev->pm_domain); if (ret) dev_pm_domain_detach(_dev, true); }