From patchwork Tue Oct 18 12:24:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 4726 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9AAB223DEF for ; Tue, 18 Oct 2011 12:25:12 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id 86B29A1893F for ; Tue, 18 Oct 2011 12:25:12 +0000 (UTC) Received: by eyg5 with SMTP id 5so594007eyg.11 for ; Tue, 18 Oct 2011 05:25:12 -0700 (PDT) Received: by 10.223.60.73 with SMTP id o9mr3799603fah.18.1318940712290; Tue, 18 Oct 2011 05:25:12 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.1.71 with SMTP id 7cs42601lak; Tue, 18 Oct 2011 05:25:11 -0700 (PDT) Received: by 10.213.25.135 with SMTP id z7mr270275ebb.28.1318940711422; Tue, 18 Oct 2011 05:25:11 -0700 (PDT) Received: from eu1sys200aog119.obsmtp.com (eu1sys200aog119.obsmtp.com. [207.126.144.147]) by mx.google.com with SMTP id s42si524700eeb.74.2011.10.18.05.25.01 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Oct 2011 05:25:11 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.147 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.147; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.147 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob119.postini.com ([207.126.147.11]) with SMTP; Tue, 18 Oct 2011 12:25:10 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 02C2A97; Tue, 18 Oct 2011 12:16:29 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 8C0ABD47; Tue, 18 Oct 2011 12:24:58 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 2131424C075; Tue, 18 Oct 2011 14:24:51 +0200 (CEST) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 18 Oct 2011 14:24:57 +0200 From: Linus Walleij To: Cc: Lee Jones , Linus Walleij Subject: [PATCH] amba: be more careful in runtime_suspend/resume Date: Tue, 18 Oct 2011 14:24:50 +0200 Message-ID: <1318940690-30138-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.3.2 MIME-Version: 1.0 From: Linus Walleij This checks that a valid pclk actually was retrieved before trying to disable/enable it in the runtime PM hooks on the PrimeCell bus. Signed-off-by: Linus Walleij --- drivers/amba/bus.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index bd230e8..57c33b9 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -378,7 +378,7 @@ static int amba_pm_runtime_suspend(struct device *dev) int ret = pm_generic_runtime_suspend(dev); if (ret == 0 && dev->driver) - clk_disable(pcdev->pclk); + amba_pclk_disable(pcdev); return ret; } @@ -388,8 +388,8 @@ static int amba_pm_runtime_resume(struct device *dev) struct amba_device *pcdev = to_amba_device(dev); int ret; - if (dev->driver) { - ret = clk_enable(pcdev->pclk); + if (dev->driver && !IS_ERR(pcdev->pclk)) { + ret = amba_pclk_enable(pcdev->pclk); /* Failure is probably fatal to the system, but... */ if (ret) return ret;