From patchwork Mon Oct 13 14:02:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 5076731 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 08FBDC11AD for ; Mon, 13 Oct 2014 14:06:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9CB242020E for ; Mon, 13 Oct 2014 14:06:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BE15F201F7 for ; Mon, 13 Oct 2014 14:06:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XdgEL-00084M-Jq; Mon, 13 Oct 2014 14:04:09 +0000 Received: from mail-wi0-f170.google.com ([209.85.212.170]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XdgDG-0007TJ-DN for linux-arm-kernel@lists.infradead.org; Mon, 13 Oct 2014 14:03:03 +0000 Received: by mail-wi0-f170.google.com with SMTP id hi2so9329668wib.1 for ; Mon, 13 Oct 2014 07:02:40 -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=FWmbFZB4XrcKzE4q/pnt6oafJSumrHv5Jy77yfsFAH0=; b=C5zbKcnv4GhGLPV54doGwk2lpFkJBIIQYOUurxBeA2KQns9WfL4xsGU0y2cm9aRB4W ZBbqPUPJcfG9c0TfvAuSOLKVHZcMSDOvvNdYbYcDdorboEWRYPlRfNDTnIk6UoAu1VE5 L4FcDaQqbNrE59yY1qRtmmL491b6+i+e1lFCN1DtJHymMweA4zMTcjR35CsoMSKnicCU 2W8n6ZvaUzRD+8R9uanHrDB89aCzDdH1s2BIkBxWBK8bbps3lx4sep1qA8EzImzYTyLj UnjKUphUCgu4UDI8gsivuehyL7KrV40zw1Hunp5CbLisq0Wfui8JBMaA3cf+OHujUMfN +37Q== X-Gm-Message-State: ALoCoQkdwA2pUi/Am/8knwfradl49Ak+V8GqKxFzLAJ+poA2v9hmxi/dZw9hGgG+PWoa0IcD5ECc X-Received: by 10.180.35.134 with SMTP id h6mr1148556wij.0.1413208960245; Mon, 13 Oct 2014 07:02:40 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id fq1sm1533474wib.12.2014.10.13.07.02.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Oct 2014 07:02:39 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Subject: [PATCH v3 5/9] i2c: core: Keep PM domain powered during ->probe() Date: Mon, 13 Oct 2014 16:02:06 +0200 Message-Id: <1413208930-26019-6-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141013_070302_631117_89CA79A7 X-CRM114-Status: GOOD ( 12.90 ) X-Spam-Score: -0.7 (/) Cc: Simon Horman , Ulf Hansson , Kevin Hilman , Russell King , Philipp Zabel , Geert Uytterhoeven , Wolfram Sang , Greg Kroah-Hartman , Mark Brown , Dmitry Torokhov , Magnus Damm , Tomasz Figa , linux-samsung-soc@vger.kernel.org, Alan Stern , Ben Dooks , Jinkun Hong , Kukjin Kim , Sylwester Nawrocki , Aaron Lu , Jack Dai , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 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/i2c/i2c-core.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 2f90ac6..37a52c6 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -646,8 +646,15 @@ static int i2c_device_probe(struct device *dev) status = dev_pm_domain_attach(&client->dev, true); if (status != -EPROBE_DEFER) { + status = dev_pm_domain_get(client->dev.pm_domain); + if (status) { + dev_pm_domain_detach(&client->dev, true); + return status; + } + status = driver->probe(client, i2c_match_id(driver->id_table, client)); + dev_pm_domain_put(client->dev.pm_domain); if (status) dev_pm_domain_detach(&client->dev, true); }