From patchwork Fri Mar 13 15:43:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 45794 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4C5E221545 for ; Fri, 13 Mar 2015 15:44:21 +0000 (UTC) Received: by wggx13 with SMTP id x13sf17079955wgg.0 for ; Fri, 13 Mar 2015 08:44:20 -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=Fv4XcfWqTJd0zr5IbBRzXQvIVnW/zNHdC7txYsHCDGw=; b=LLM2uCTAsROmWe7hTmLDNkG8hcDqMhtzUPHkZFTgonp+CJYjkPbdjG7AfFQSrFBJUU woLpShHmx4msw+r/BJW04Xg81MKxtz+w1o90hAeMtvDLSmKaUhY7GAmYPq/0M0OZz4ao NTr8wu9LyUB6M9Tdq6hIUn4TMWJN8FtTo9EemiBurbh0goq7cDoOTUIFOfQWXQULXVOR ybURBVZwmcKU+PNqdRPoMIozo+e1ImzPiYF8LGrHk0FQc8nyEL9AalrLkIsD44QKso1C d6YaYbrfprUdTCn0ktuzDqcEBwBZawZaekwK5eXBigNBNJH1GZqDvzGW/VrkvZd22xYZ ++1Q== X-Gm-Message-State: ALoCoQmYDtmOj3QJFUSIBpHGF5b9bSwv2IJ/jVnjfIIqJtMh1x+LTmfpDKa3aRu22bMGf+kp0u32 X-Received: by 10.112.35.135 with SMTP id h7mr7260824lbj.23.1426261460597; Fri, 13 Mar 2015 08:44:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.225 with SMTP id n1ls435985lah.52.gmail; Fri, 13 Mar 2015 08:44:20 -0700 (PDT) X-Received: by 10.152.22.200 with SMTP id g8mr42982089laf.96.1426261460221; Fri, 13 Mar 2015 08:44:20 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id yj9si1636820lbb.100.2015.03.13.08.44.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Mar 2015 08:44:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by labhs14 with SMTP id hs14so22913852lab.5 for ; Fri, 13 Mar 2015 08:44:20 -0700 (PDT) X-Received: by 10.152.197.34 with SMTP id ir2mr43777091lac.36.1426261460123; Fri, 13 Mar 2015 08:44:20 -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 h5csp1000058lbj; Fri, 13 Mar 2015 08:44:19 -0700 (PDT) X-Received: by 10.152.225.167 with SMTP id rl7mr44622229lac.54.1426261458629; Fri, 13 Mar 2015 08:44:18 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id ul4si1627937lbb.171.2015.03.13.08.44.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Mar 2015 08:44:18 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by labmn12 with SMTP id mn12so23556879lab.0 for ; Fri, 13 Mar 2015 08:44:18 -0700 (PDT) X-Received: by 10.112.150.131 with SMTP id ui3mr44308191lbb.62.1426261458524; Fri, 13 Mar 2015 08:44:18 -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.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Mar 2015 08:44:17 -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 6/9] spi: core: Keep PM domain powered during ->probe() Date: Fri, 13 Mar 2015 16:43:46 +0100 Message-Id: <1426261429-31883-7-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.215.51 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/spi/spi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index c64a3e5..bb75a0f 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -263,7 +263,14 @@ static int spi_drv_probe(struct device *dev) ret = dev_pm_domain_attach(dev, true); if (ret != -EPROBE_DEFER) { + ret = dev_pm_domain_get(dev->pm_domain); + if (ret) { + dev_pm_domain_detach(dev, true); + return ret; + } + ret = sdrv->probe(to_spi_device(dev)); + dev_pm_domain_put(dev->pm_domain); if (ret) dev_pm_domain_detach(dev, true); }