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: 38663 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3A30F20CC8 for ; Mon, 13 Oct 2014 14:02:45 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id gi9sf4258734lab.2 for ; Mon, 13 Oct 2014 07:02:44 -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=FWmbFZB4XrcKzE4q/pnt6oafJSumrHv5Jy77yfsFAH0=; b=DqHeFmjJVS2M6jFlQat9WyH47xWlIgBPeCYbq17aKwY0xc+4nKN+LZhirlyk7XCA78 GECjm/BOioGsiPJqVauSLPZUn1Z/Ezap0SUhT4BqIHjPhfqcH/5jdn82R1ymuWKZCKEw vpOc0mfRhWfVKdKMqOXYVw60k6fyaWIiOp1ui/634UoGtBQkLcRmX0WkI1jjBp2lpd6o /VEc3cYJhbT8BVtK1/66lDK4npe2Fg01wqvqDoGOj3ahX88SASz4lPeIqC6LxEIWJRpn UwUwyB6QbCHWQDsFZOGvqW4mqUku2rsNboyAjBKnY6jAVuznqHj6mi811ivYK7StemSu eAfQ== X-Gm-Message-State: ALoCoQnrOtdaNf/hjGXB1ul9pwnheh2TJpagThFj2DFhooHzWfB6HoovYUARM1KjT68NGNf8BNGz X-Received: by 10.152.43.66 with SMTP id u2mr4124287lal.1.1413208963969; Mon, 13 Oct 2014 07:02:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.130 with SMTP id z2ls495131laa.61.gmail; Mon, 13 Oct 2014 07:02:43 -0700 (PDT) X-Received: by 10.153.11.166 with SMTP id ej6mr3750095lad.80.1413208963834; Mon, 13 Oct 2014 07:02:43 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com [209.85.217.169]) by mx.google.com with ESMTPS id xt10si11291963lab.4.2014.10.13.07.02.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Oct 2014 07:02:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id 10so6509040lbg.0 for ; Mon, 13 Oct 2014 07:02:43 -0700 (PDT) X-Received: by 10.113.10.9 with SMTP id dw9mr24399001lbd.46.1413208963709; Mon, 13 Oct 2014 07:02:43 -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.84.229 with SMTP id c5csp220137lbz; Mon, 13 Oct 2014 07:02:43 -0700 (PDT) X-Received: by 10.180.101.200 with SMTP id fi8mr918597wib.77.1413208960494; Mon, 13 Oct 2014 07:02:40 -0700 (PDT) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by mx.google.com with ESMTPS id lm13si12722656wic.56.2014.10.13.07.02.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Oct 2014 07:02:40 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.212.182 as permitted sender) client-ip=209.85.212.182; Received: by mail-wi0-f182.google.com with SMTP id n3so7532264wiv.9 for ; Mon, 13 Oct 2014 07:02:40 -0700 (PDT) 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> 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.169 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 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); }