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: 6006461 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8486A9F318 for ; Fri, 13 Mar 2015 15:47:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE912201F5 for ; Fri, 13 Mar 2015 15:47:52 +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 C08F220221 for ; Fri, 13 Mar 2015 15:47:51 +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 1YWRmJ-00057E-Me; Fri, 13 Mar 2015 15:45:35 +0000 Received: from mail-lb0-f171.google.com ([209.85.217.171]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YWRlJ-0003ZT-Ra for linux-arm-kernel@lists.infradead.org; Fri, 13 Mar 2015 15:44:34 +0000 Received: by lbiz11 with SMTP id z11so23705517lbi.3 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=OKyZ02y3oJ2kFfpTVEGUD1DPZf0AoBvj4zaz2I0PHhKCWd/Kl7cKBTMPHtH9HO2h1V ufB8mmMrGLqkKWdbdqLx3HmgBNMORFqOEq9zF4PWzreWzyppPgwnBOcakuGgGLX0mZKf y4MhSL1/LDKUA7WqcFSvhn/y9N/4CMe9MpHjeUzlee1zLMlnJb+NyPZTCYO874gOV2OQ xM4S6PapwEqWOd+oRyg5gb6P99nyyCR7hjCz5UaAFKenlub0K04ZyERiRrKUOlErAbVN mnqVQ/ClBpnMK6GAXhdLBNWIa5oL0znpoiCy5fICWsgFJa3X/Qsxw/hrbCsuDu7mMSCy iHzw== X-Gm-Message-State: ALoCoQl4oIazn7qLpY0DuoA46ntjaFkecMXbgojFlmjqVE+gYnyobpJhGh+agj660PaHuHm6qRE8 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150313_084434_139615_D386ACA1 X-CRM114-Status: GOOD ( 10.00 ) X-Spam-Score: -0.7 (/) Cc: Ulf Hansson , Russell King , Geert Uytterhoeven , Wolfram Sang , Greg Kroah-Hartman , Dmitry Torokhov , Mark Brown , 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=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 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); }