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: 6006501 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 90CFEBF90F for ; Fri, 13 Mar 2015 15:49:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 95CCD20218 for ; Fri, 13 Mar 2015 15:49:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C036D201F5 for ; Fri, 13 Mar 2015 15:49:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YWRn9-0005cg-D8; Fri, 13 Mar 2015 15:46:27 +0000 Received: from mail-la0-f54.google.com ([209.85.215.54]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YWRlQ-0003aJ-P7 for linux-arm-kernel@lists.infradead.org; Fri, 13 Mar 2015 15:44:41 +0000 Received: by labgq15 with SMTP id gq15so23487469lab.4 for ; Fri, 13 Mar 2015 08:44:18 -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=Fv4XcfWqTJd0zr5IbBRzXQvIVnW/zNHdC7txYsHCDGw=; b=NS7ncR8iPP91UVCcxMLsWxCbfhX2DbuPZOHufxMaLpF/U6TrLPlg3VrgB4vxClCVYG PBxGQrLn+05RvoUsSoZp+I698yu69JjEpIduELIcFFB/NH5a14OrEI02dqyBFk7BbbeV 7cDP6BhFZLB1NNpXBj3KJU6WOe2s3bhN0VKSTMt6ZZxPvKe0tUJFPcuuHe2qSyij+7lM UmH67Sa0hCJS6Y/u/ADFyy69vy+mYNPGiTITvkB2e41lQ/0nysA8oh4xDHoIQvFHeY/d OaFDr4D6DdHXOXwR5oer0KyCj36EV/PfL6byZzdsA9LNtET3eSAAN6h2ciL7zctNxWP+ /B3A== X-Gm-Message-State: ALoCoQlWHBxidXhk+IGzXnNp28Ujjreal5dsv+oD8GGnPlBIK4AR7SDcmTySTVicpMq/elL16+mE 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150313_084441_048296_BDDA1607 X-CRM114-Status: GOOD ( 10.09 ) X-Spam-Score: -0.7 (/) Cc: Ulf Hansson , Russell King , Geert Uytterhoeven , Wolfram Sang , Greg Kroah-Hartman , Dmitry Torokhov , Mark Brown , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 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); }