[CPUFREQ] Remove redundant initialisation from longhaul.
[pandora-kernel.git] / arch / i386 / kernel / cpu / cpufreq / longhaul.c
index 04e3563..146f607 100644 (file)
@@ -64,8 +64,6 @@ static int dont_scale_voltage;
 #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "longhaul", msg)
 
 
-#define __hlt()     __asm__ __volatile__("hlt": : :"memory")
-
 /* Clock ratios multiplied by 10 */
 static int clock_ratio[32];
 static int eblcr_table[32];
@@ -79,13 +77,17 @@ static char speedbuffer[8];
 
 static char *print_speed(int speed)
 {
-       if (speed > 1000) {
-               if (speed%1000 == 0)
-                       sprintf (speedbuffer, "%dGHz", speed/1000);
-               else
-                       sprintf (speedbuffer, "%d.%dGHz", speed/1000, (speed%1000)/100);
-       } else
-               sprintf (speedbuffer, "%dMHz", speed);
+       if (speed < 1000) {
+               snprintf(speedbuffer, sizeof(speedbuffer),"%dMHz", speed);
+               return speedbuffer;
+       }
+
+       if (speed%1000 == 0)
+               snprintf(speedbuffer, sizeof(speedbuffer),
+                       "%dGHz", speed/1000);
+       else
+               snprintf(speedbuffer, sizeof(speedbuffer),
+                       "%d.%dGHz", speed/1000, (speed%1000)/100);
 
        return speedbuffer;
 }
@@ -168,11 +170,9 @@ static void do_powersaver(union msr_longhaul *longhaul,
        outb(0xFE,0x21);        /* TMR0 only */
        outb(0xFF,0x80);        /* delay */
 
-       local_irq_enable();
-
-       __hlt();
+       safe_halt();
        wrmsrl(MSR_VIA_LONGHAUL, longhaul->val);
-       __hlt();
+       halt();
 
        local_irq_disable();
 
@@ -251,9 +251,7 @@ static void longhaul_setstate(unsigned int clock_ratio_index)
                bcr2.bits.CLOCKMUL = clock_ratio_index;
                local_irq_disable();
                wrmsrl (MSR_VIA_BCR2, bcr2.val);
-               local_irq_enable();
-
-               __hlt();
+               safe_halt();
 
                /* Disable software clock multiplier */
                rdmsrl (MSR_VIA_BCR2, bcr2.val);
@@ -473,11 +471,11 @@ static void __init longhaul_setup_voltagescaling(void)
        }
 
        if (vrmrev==0) {
-               dprintk ("VRM 8.5 \n");
+               dprintk ("VRM 8.5\n");
                memcpy (voltage_table, vrm85scales, sizeof(voltage_table));
                numvscales = (voltage_table[maxvid]-voltage_table[minvid])/25;
        } else {
-               dprintk ("Mobile VRM \n");
+               dprintk ("Mobile VRM\n");
                memcpy (voltage_table, mobilevrmscales, sizeof(voltage_table));
                numvscales = (voltage_table[maxvid]-voltage_table[minvid])/5;
        }
@@ -681,7 +679,7 @@ static int __init longhaul_init(void)
 
 static void __exit longhaul_exit(void)
 {
-       int i=0;
+       int i;
 
        for (i=0; i < numscales; i++) {
                if (clock_ratio[i] == maxmult) {