From patchwork Wed Jan 11 14:55:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 6160 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 1B18223E0E for ; Wed, 11 Jan 2012 14:56:02 +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 122E1A1853C for ; Wed, 11 Jan 2012 14:56:02 +0000 (UTC) Received: by mail-ey0-f180.google.com with SMTP id e12so239857eaa.11 for ; Wed, 11 Jan 2012 06:56:02 -0800 (PST) Received: by 10.204.152.20 with SMTP id e20mr9841677bkw.117.1326293761860; Wed, 11 Jan 2012 06:56:01 -0800 (PST) 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.205.82.144 with SMTP id ac16cs110615bkc; Wed, 11 Jan 2012 06:56:01 -0800 (PST) Received: by 10.180.79.10 with SMTP id f10mr11341501wix.0.1326293760525; Wed, 11 Jan 2012 06:56:00 -0800 (PST) Received: from mail-ww0-f42.google.com (mail-ww0-f42.google.com [74.125.82.42]) by mx.google.com with ESMTPS id q4si973748wie.17.2012.01.11.06.55.59 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 11 Jan 2012 06:56:00 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.42 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=74.125.82.42; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.42 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: by wgbdt14 with SMTP id dt14so3883581wgb.1 for ; Wed, 11 Jan 2012 06:55:59 -0800 (PST) Received: by 10.181.13.208 with SMTP id fa16mr20294301wid.12.1326293759452; Wed, 11 Jan 2012 06:55:59 -0800 (PST) Received: from localhost.localdomain (AToulouse-159-1-69-110.w92-134.abo.wanadoo.fr. [92.134.92.110]) by mx.google.com with ESMTPS id a6sm4608647wiy.6.2012.01.11.06.55.57 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 11 Jan 2012 06:55:58 -0800 (PST) From: Daniel Lezcano To: linux@arm.linux.org.uk Cc: robherring2@gmail.com, khilman@ti.com, len.brown@intel.com, linux-pm@vger.kernel.org, magnus.damm@gmail.com, s.hauer@pengutronix.de, nicolas.ferre@atmel.com, nsekhar@ti.com, linux@maxim.org.za, arnd.bergmann@linaro.org, rob.lee@linaro.org, shawn.guo@freescale.com, linux-arm-kernel@lists.infradead.org, amit.kucheria@linaro.org Subject: [PATCH 7/7] at91 : fix compilation warning Date: Wed, 11 Jan 2012 15:55:40 +0100 Message-Id: <1326293740-15735-8-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1326293740-15735-1-git-send-email-daniel.lezcano@linaro.org> References: <1326293740-15735-1-git-send-email-daniel.lezcano@linaro.org> Move the clock routine in a function. That will prevent to have a warning from the compiler to say there is unused variable. Signed-off-by: Daniel Lezcano --- arch/arm/mach-at91/pm.c | 40 ++++++++++++++++++++++++---------------- 1 files changed, 24 insertions(+), 16 deletions(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index f97bbfa..2250773 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -132,6 +132,28 @@ static int at91_pm_begin(suspend_state_t state) return 0; } +static inline int at91_program_clock(unsigned long scsr) +{ +#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS + int i; + + /* PCK0..PCK3 must be disabled, or configured to use clk32k */ + for (i = 0; i < 4; i++) { + u32 css; + + if ((scsr & (AT91_PMC_PCK0 << i)) == 0) + continue; + + css = at91_sys_read(AT91_PMC_PCKR(i)) & AT91_PMC_CSS; + if (css != AT91_PMC_CSS_SLOW) { + pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css); + return -1; + } + } +#endif + return 0; +} + /* * Verify that all the clocks are correct before entering * slow-clock mode. @@ -139,7 +161,6 @@ static int at91_pm_begin(suspend_state_t state) static int at91_pm_verify_clocks(void) { unsigned long scsr; - int i; scsr = at91_sys_read(AT91_PMC_SCSR); @@ -162,21 +183,8 @@ static int at91_pm_verify_clocks(void) } } -#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS - /* PCK0..PCK3 must be disabled, or configured to use clk32k */ - for (i = 0; i < 4; i++) { - u32 css; - - if ((scsr & (AT91_PMC_PCK0 << i)) == 0) - continue; - - css = at91_sys_read(AT91_PMC_PCKR(i)) & AT91_PMC_CSS; - if (css != AT91_PMC_CSS_SLOW) { - pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css); - return 0; - } - } -#endif + if (at91_program_clock(scsr)) + return 0; return 1; }