From patchwork Fri Mar 13 15:43:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 6006371 Return-Path: X-Original-To: patchwork-linux-pm@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 80742BF90F for ; Fri, 13 Mar 2015 15:44:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7E61920225 for ; Fri, 13 Mar 2015 15:44:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4255020218 for ; Fri, 13 Mar 2015 15:44:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756835AbbCMPoT (ORCPT ); Fri, 13 Mar 2015 11:44:19 -0400 Received: from mail-la0-f51.google.com ([209.85.215.51]:36979 "EHLO mail-la0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757131AbbCMPoS (ORCPT ); Fri, 13 Mar 2015 11:44:18 -0400 Received: by labgq15 with SMTP id gq15so23487229lab.4 for ; Fri, 13 Mar 2015 08:44:16 -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=kW1dFa9pawp3SbMmqaynL1sr+C6gH3TfWjKOMskfia0=; b=lCzZ/oJ3FlsV0gfEh8MaFVJcNd85yLlZW3RDXfrkOD570gmMny47ZOuAkiH8ujFXsE mesK//JvEQSYBqq0SdSbcmq3hkUKGX0Hk4WL53BiITbfVuWFrHup7EIuQOy2y6lxfS/Q O1U0zFGGiGUHh9BRVfiP23kROxmigHfC0DDwM8/2aq1FDNori+/L4ujzFYg/mcqeUvp1 HkiD1IK70Pcnz+QAbPrHZJhQEEA3D6cd6xGExeFGF3hGhk9bybcd7wbLtwEwARkU8w1d pGBIkWElVsulTuVD6BLsLOgltHmeRPMKbNFxh9GtEsOFMsxH6MqS0jkYTsCvEfYsUUhi apFw== X-Gm-Message-State: ALoCoQkTk5/mkWd/JjWa2Zi5GQAXysOYKCjRBy6ouljg3WJBhNmYUQZOFboD8BZf192Q1xBBdUjN X-Received: by 10.112.110.231 with SMTP id id7mr44073364lbb.28.1426261456371; Fri, 13 Mar 2015 08:44:16 -0700 (PDT) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id i9sm471248lbs.26.2015.03.13.08.44.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Mar 2015 08:44:15 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , Kevin Hilman , linux-pm@vger.kernel.org Cc: Geert Uytterhoeven , Dmitry Torokhov , Russell King , Greg Kroah-Hartman , Mark Brown , Wolfram Sang , linux-arm-kernel@lists.infradead.org, Ulf Hansson Subject: [PATCH 5/9] i2c: core: Keep PM domain powered during ->probe() Date: Fri, 13 Mar 2015 16:43:45 +0100 Message-Id: <1426261429-31883-6-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426261429-31883-1-git-send-email-ulf.hansson@linaro.org> References: <1426261429-31883-1-git-send-email-ulf.hansson@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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/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 210cf48..0eabe55 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -655,8 +655,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); }