From patchwork Mon Oct 13 14:02:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 5076591 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8E8EAC11AC for ; Mon, 13 Oct 2014 14:03:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D2B4201C7 for ; Mon, 13 Oct 2014 14:03:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6685320204 for ; Mon, 13 Oct 2014 14:03:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754093AbaJMOCq (ORCPT ); Mon, 13 Oct 2014 10:02:46 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:36778 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754140AbaJMOCo (ORCPT ); Mon, 13 Oct 2014 10:02:44 -0400 Received: by mail-wi0-f171.google.com with SMTP id em10so7494080wid.4 for ; Mon, 13 Oct 2014 07:02:43 -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=S5bIjZOiYu0ypatf7Z+KEmTU/hSl58f3u1ba/Kim4M0=; b=Gh67Jv1x+DanI4crYTOBtLEAeYW+MG0QVjaHbYvHrknDJBTxxreCEcrQmY1rFzckT0 BJbjSzqiiEGVpGJIzZ+R18TGQS86Df+7za1agb7SiPbNU1HTtGXo+uVF3adFi50efmvj iqeGvcwiOk/MCu4SBFf87LW/I+eqvsJ8BFSHUUq4yMKCn9GFd2FFFzkGTtVwrO3GeLQ8 jfHXGAEx1C8NiHwcRcQpOKUR/0xGzIDAzqwnmMC453+qZCC4cxv0i0pYFVbM3sR5wUdi QiMp7jLzks2/yroZfGwcap+O8iXy5GXAOV/IrRG+p2xQzC5ICPaBpAYDpYqwF5t1RZUJ GmZw== X-Gm-Message-State: ALoCoQk04l5sjgi1PAmLJhoUFA/ej1swb5wGiJSZwWFrshQbV7hPVxEvZgydzGUhoSfxucexdusq X-Received: by 10.194.237.164 with SMTP id vd4mr20569843wjc.46.1413208962498; Mon, 13 Oct 2014 07:02:42 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id fq1sm1533474wib.12.2014.10.13.07.02.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Oct 2014 07:02:41 -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 6/9] spi: core: Keep PM domain powered during ->probe() Date: Mon, 13 Oct 2014 16:02:07 +0200 Message-Id: <1413208930-26019-7-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=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/spi/spi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 3907f14..ad1a6f3 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -267,7 +267,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); }