From eed7d41257e2a2a38b3ad121b8948f7bfeaa21c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=B3=20Bilski?= <rafalbilski@interia.pl>
Date: Wed, 27 Sep 2006 08:25:27 +0200
Subject: [PATCH] [CPUFREQ] longhaul: remove duplicated code.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

removing duplicated code.

Signed-off-by: RafaƂ Bilski <rafalbilski@interia.pl>
Signed-off-by: Dave Jones <davej@redhat.com>
---
 arch/i386/kernel/cpu/cpufreq/longhaul.c | 29 ++++++++++---------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
index 4e8dd743d00b3e..7233abe5d69553 100644
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -581,8 +581,8 @@ static int enable_arbiter_disable(void)
 	dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8601_0, NULL);
 	/* Find CLE266 host bridge */
 	if (dev == NULL) {
-		dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_862X_0, NULL);
 		reg = 0x76;
+		dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_862X_0, NULL);
 	}
 	if (dev != NULL) {
 		/* Enable access to port 0x22 */
@@ -693,25 +693,20 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
 	if (longhaul_version == TYPE_POWERSAVER) {
 		/* Check ACPI support for C3 state */
 		cx = &pr->power.states[ACPI_STATE_C3];
-		if (cx->address == 0 ||
-		   (cx->latency > 1000 && ignore_latency == 0) ) {
-			if (enable_arbiter_disable()) {
-				port22_en = 1;
-			} else {
-				goto err_acpi;
-			}
+		if (cx->address > 0 &&
+		   (cx->latency <= 1000 || ignore_latency != 0) ) {
+			goto print_support_type;
 		}
-
-	} else {
-		/* Check ACPI support for bus master arbiter disable */
-		if (!pr->flags.bm_control) {
-			if (enable_arbiter_disable()) {
-				port22_en = 1;
-			} else {
-				goto err_acpi;
-			}
+	}
+	/* Check ACPI support for bus master arbiter disable */
+	if (!pr->flags.bm_control) {
+		if (enable_arbiter_disable()) {
+			port22_en = 1;
+		} else {
+			goto err_acpi;
 		}
 	}
+print_support_type:
 	if (!port22_en) {
 		printk (KERN_INFO PFX "Using ACPI support.\n");
 	} else {
-- 
GitLab