linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sivaramn@nvidia.com (Sivaram Nair)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/1] ARM: tegra: replace long if statement group
Date: Tue, 27 Nov 2012 08:53:33 +0200	[thread overview]
Message-ID: <1353999213-4889-1-git-send-email-sivaramn@nvidia.com> (raw)

The long list of if statements are replaced with corresponding
switch cases.

Signed-off-by: Sivaram Nair <sivaramn@nvidia.com>
---
 arch/arm/mach-tegra/tegra30_clocks.c |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-tegra/tegra30_clocks.c b/arch/arm/mach-tegra/tegra30_clocks.c
index d714777..753addd 100644
--- a/arch/arm/mach-tegra/tegra30_clocks.c
+++ b/arch/arm/mach-tegra/tegra30_clocks.c
@@ -444,21 +444,23 @@ static unsigned long clk_measure_input_freq(void)
 	clk_writel(OSC_FREQ_DET_TRIG | 1, OSC_FREQ_DET);
 	do {} while (clk_readl(OSC_FREQ_DET_STATUS) & OSC_FREQ_DET_BUSY);
 	clock_autodetect = clk_readl(OSC_FREQ_DET_STATUS);
-	if (clock_autodetect >= 732 - 3 && clock_autodetect <= 732 + 3) {
+
+	switch (clock_autodetect) {
+	case (732 - 3)...(732 + 3):
 		return 12000000;
-	} else if (clock_autodetect >= 794 - 3 && clock_autodetect <= 794 + 3) {
+	case (794 - 3)...(794 + 3):
 		return 13000000;
-	} else if (clock_autodetect >= 1172 - 3 && clock_autodetect <= 1172 + 3) {
+	case (1172 - 3)...(1172 + 3):
 		return 19200000;
-	} else if (clock_autodetect >= 1587 - 3 && clock_autodetect <= 1587 + 3) {
+	case (1587 - 3)...(1587 + 3):
 		return 26000000;
-	} else if (clock_autodetect >= 1025 - 3 && clock_autodetect <= 1025 + 3) {
+	case (1025 - 3)...(1025 + 3):
 		return 16800000;
-	} else if (clock_autodetect >= 2344 - 3 && clock_autodetect <= 2344 + 3) {
+	case (2344 - 3)...(2344 + 3):
 		return 38400000;
-	} else if (clock_autodetect >= 2928 - 3 && clock_autodetect <= 2928 + 3) {
+	case (2928 - 3)...(2928 + 3):
 		return 48000000;
-	} else {
+	default:
 		pr_err("%s: Unexpected clock autodetect value %d", __func__,
 			clock_autodetect);
 		BUG();
-- 
1.7.9.5

                 reply	other threads:[~2012-11-27  6:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1353999213-4889-1-git-send-email-sivaramn@nvidia.com \
    --to=sivaramn@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).