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: 5076571 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 C75429F65C for ; Mon, 13 Oct 2014 14:02:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CEC4120211 for ; Mon, 13 Oct 2014 14:02:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D6D3E20204 for ; Mon, 13 Oct 2014 14:02:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754133AbaJMOCn (ORCPT ); Mon, 13 Oct 2014 10:02:43 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:57322 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754093AbaJMOCl (ORCPT ); Mon, 13 Oct 2014 10:02:41 -0400 Received: by mail-wi0-f179.google.com with SMTP id d1so7563458wiv.0 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=fgUbHCssm2YDGnqJd5eDRwwjqNDI/BXecWf463fnQmMO2CiD8ZK/DXuitlFFs9Qfjh lapIhI2kD6nk5Dq62dLExEuT3Mta3yfbua2svXoe+ShGxaVtI77rmZHfe8/Yk032+qZS zCd1bw95C0YYw+2nexW28uRWXY1XckECnht4+AU76EEIdfoLqp8wkjuOIRPf6UgMQ+pr wqqhs6zAlon90fYAC7macdXG5ehui7wibroiBr0bNqrnpDHZVELS5Eq0nFv6F3oVGFnM NdS91UNu0c9iMJPGiesrfvWPvErJYVDo6fVUJFmcG76TnQt4PFQ/cQ2Khac8CZyb4HbN LwVg== X-Gm-Message-State: ALoCoQnP1issTp2uhByViPHN+LJZiQAyxW95XarWrnlc1t/atuXV3ilKfaxbg3F2IWX5ediVGmgP 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 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 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> 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/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); }