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: 45793 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3E810214BF for ; Fri, 13 Mar 2015 15:44:18 +0000 (UTC) Received: by lbvp9 with SMTP id p9sf17421988lbv.0 for ; Fri, 13 Mar 2015 08:44:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=kW1dFa9pawp3SbMmqaynL1sr+C6gH3TfWjKOMskfia0=; b=cmegzBxF4jslm3DB/3DZiNOIpxhcRzd7H9oL4JO1dSjgP/hOdLajDDscIosOulHcla OWpFy/homyD6+nif44uLQk52lE8mpDpjiXqyof3xYrxt63rhPm0HR3ncNJRgl9Qs4Zep SIjFThb674jBvDnBY7Ylf+GvzRhC1To23nnppUQozheNceiZGMD/APubCjQPIeW25ZDy +rCzU1MABbp8C+hCf3X1WfnJEcLCQhObgXl9Wo/6hMC6Qn85a/pI1wpbiNTbeOTIOisR QdQkgERc7POaYmFl1M4KJlpIfCxUn6Bf8N7hx1ljBTIY847kf19EH3IQb4n6Jc9ExYl4 fI1g== X-Gm-Message-State: ALoCoQlweQJyaBL40uateIR1BZiHY55z5YS/zwttNRrErSQ0bKpD0VIAKgE6pghG/xcvyW5aNE4y X-Received: by 10.180.80.35 with SMTP id o3mr505327wix.0.1426261457145; Fri, 13 Mar 2015 08:44:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.225 with SMTP id z1ls429768lad.109.gmail; Fri, 13 Mar 2015 08:44:16 -0700 (PDT) X-Received: by 10.152.116.11 with SMTP id js11mr21980057lab.106.1426261456924; Fri, 13 Mar 2015 08:44:16 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id pv9si1649910lbb.2.2015.03.13.08.44.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Mar 2015 08:44:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbvp9 with SMTP id p9so23646629lbv.10 for ; Fri, 13 Mar 2015 08:44:16 -0700 (PDT) X-Received: by 10.152.178.197 with SMTP id da5mr45050920lac.56.1426261456845; Fri, 13 Mar 2015 08:44:16 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.35.133 with SMTP id h5csp1000022lbj; Fri, 13 Mar 2015 08:44:16 -0700 (PDT) X-Received: by 10.152.22.1 with SMTP id z1mr32433576lae.114.1426261456473; Fri, 13 Mar 2015 08:44:16 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id ti8si1630993lbb.149.2015.03.13.08.44.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Mar 2015 08:44:16 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbvp9 with SMTP id p9so23646583lbv.10 for ; Fri, 13 Mar 2015 08:44:16 -0700 (PDT) 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> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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); }