From patchwork Tue Jan 14 12:23:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 3485641 Return-Path: X-Original-To: patchwork-linux-sh@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 2EE9EC02DC for ; Tue, 14 Jan 2014 12:24:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 27D2720203 for ; Tue, 14 Jan 2014 12:24:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D515420200 for ; Tue, 14 Jan 2014 12:24:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751550AbaANMXu (ORCPT ); Tue, 14 Jan 2014 07:23:50 -0500 Received: from 82-68-191-81.dsl.posilan.com ([82.68.191.81]:57714 "EHLO rainbowdash.ducie.codethink.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751287AbaANMXr (ORCPT ); Tue, 14 Jan 2014 07:23:47 -0500 Received: from ben by rainbowdash.ducie.codethink.co.uk with local (Exim 4.82) (envelope-from ) id 1W331z-0004VI-Qu; Tue, 14 Jan 2014 12:23:43 +0000 From: Ben Dooks To: linux-kernel@lists.codethink.co.uk, "Rafael J. Wysocki" , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman Cc: Ben Dooks , Pavel Machek , linux-pm@vger.kernel.org Subject: [PATCH 3/3] power: clock_ops.c: report clock errors from clk_enable() Date: Tue, 14 Jan 2014 12:23:42 +0000 Message-Id: <1389702222-17260-4-git-send-email-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1389702222-17260-1-git-send-email-ben.dooks@codethink.co.uk> References: <1389702222-17260-1-git-send-email-ben.dooks@codethink.co.uk> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 If clk_enable() fails, then print a message so that the user can see what is happening instead of silently failing to enable the clock. Cc: "Rafael J. Wysocki" Cc: Pavel Machek Cc: Greg Kroah-Hartman Cc: linux-pm@vger.kernel.org Cc: linux-sh@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Ben Dooks Reviewed-by: Ian Molton --- drivers/base/power/clock_ops.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index cad7190..e870bbe 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c @@ -33,6 +33,21 @@ struct pm_clock_entry { }; /** + * pm_clk_enable - Enable a clock, reporting any errors + * @dev: The device for the given clock + * @clk: The clock being enabled. + */ +static inline int __pm_clk_enable(struct device *dev, struct clk *clk) +{ + int ret = clk_enable(clk); + if (ret) + dev_err(dev, "%s: failed to enable clk %p, error %d\n", + __func__, clk, ret); + + return ret; +} + +/** * pm_clk_acquire - Acquire a device clock. * @dev: Device whose clock is to be acquired. * @ce: PM clock entry corresponding to the clock. @@ -263,7 +278,7 @@ int pm_clk_resume(struct device *dev) list_for_each_entry(ce, &psd->clock_list, node) { if (ce->status < PCE_STATUS_ERROR) { - ret = clk_enable(ce->clk); + ret = __pm_clk_enable(dev, ce->clk); if (!ret) ce->status = PCE_STATUS_ENABLED; } @@ -381,7 +396,7 @@ int pm_clk_resume(struct device *dev) spin_lock_irqsave(&psd->lock, flags); list_for_each_entry(ce, &psd->clock_list, node) - clk_enable(ce->clk); + __pm_clk_enable(dev, ce->clk); spin_unlock_irqrestore(&psd->lock, flags);