Merge branches 'acpi-dptf' and 'acpi-messages'
[linux-2.6-microblaze.git] / drivers / acpi / processor_throttling.c
index dbccc92..a822fe4 100644 (file)
@@ -9,6 +9,8 @@
  *                      - Added processor hotplug support
  */
 
+#define pr_fmt(fmt) "ACPI: " fmt
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -20,8 +22,6 @@
 #include <asm/io.h>
 #include <linux/uaccess.h>
 
-#define PREFIX "ACPI: "
-
 /* ignore_tpc:
  *  0 -> acpi processor driver doesn't ignore _TPC values
  *  1 -> acpi processor driver ignores _TPC values
@@ -234,8 +234,7 @@ static int acpi_processor_throttling_notifier(unsigned long event, void *data)
                if (pr->throttling_platform_limit > target_state)
                        target_state = pr->throttling_platform_limit;
                if (target_state >= p_throttling->state_count) {
-                       printk(KERN_WARNING
-                               "Exceed the limit of T-state \n");
+                       pr_warn("Exceed the limit of T-state \n");
                        target_state = p_throttling->state_count - 1;
                }
                p_tstate->target_state = target_state;
@@ -254,8 +253,7 @@ static int acpi_processor_throttling_notifier(unsigned long event, void *data)
                                  cpu, target_state);
                break;
        default:
-               printk(KERN_WARNING
-                       "Unsupported Throttling notifier event\n");
+               pr_warn("Unsupported Throttling notifier event\n");
                break;
        }
 
@@ -420,7 +418,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
        ptc = (union acpi_object *)buffer.pointer;
        if (!ptc || (ptc->type != ACPI_TYPE_PACKAGE)
            || (ptc->package.count != 2)) {
-               printk(KERN_ERR PREFIX "Invalid _PTC data\n");
+               pr_err("Invalid _PTC data\n");
                result = -EFAULT;
                goto end;
        }
@@ -434,8 +432,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
        if ((obj.type != ACPI_TYPE_BUFFER)
            || (obj.buffer.length < sizeof(struct acpi_ptc_register))
            || (obj.buffer.pointer == NULL)) {
-               printk(KERN_ERR PREFIX
-                      "Invalid _PTC data (control_register)\n");
+               pr_err("Invalid _PTC data (control_register)\n");
                result = -EFAULT;
                goto end;
        }
@@ -451,7 +448,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
        if ((obj.type != ACPI_TYPE_BUFFER)
            || (obj.buffer.length < sizeof(struct acpi_ptc_register))
            || (obj.buffer.pointer == NULL)) {
-               printk(KERN_ERR PREFIX "Invalid _PTC data (status_register)\n");
+               pr_err("Invalid _PTC data (status_register)\n");
                result = -EFAULT;
                goto end;
        }
@@ -463,14 +460,14 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
 
        if ((throttling->control_register.bit_width +
                throttling->control_register.bit_offset) > 32) {
-               printk(KERN_ERR PREFIX "Invalid _PTC control register\n");
+               pr_err("Invalid _PTC control register\n");
                result = -EFAULT;
                goto end;
        }
 
        if ((throttling->status_register.bit_width +
                throttling->status_register.bit_offset) > 32) {
-               printk(KERN_ERR PREFIX "Invalid _PTC status register\n");
+               pr_err("Invalid _PTC status register\n");
                result = -EFAULT;
                goto end;
        }
@@ -504,7 +501,7 @@ static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
 
        tss = buffer.pointer;
        if (!tss || (tss->type != ACPI_TYPE_PACKAGE)) {
-               printk(KERN_ERR PREFIX "Invalid _TSS data\n");
+               pr_err("Invalid _TSS data\n");
                result = -EFAULT;
                goto end;
        }
@@ -544,8 +541,7 @@ static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
                }
 
                if (!tx->freqpercentage) {
-                       printk(KERN_ERR PREFIX
-                              "Invalid _TSS data: freq is zero\n");
+                       pr_err("Invalid _TSS data: freq is zero\n");
                        result = -EFAULT;
                        kfree(pr->throttling.states_tss);
                        goto end;
@@ -585,13 +581,13 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr)
 
        tsd = buffer.pointer;
        if (!tsd || (tsd->type != ACPI_TYPE_PACKAGE)) {
-               printk(KERN_ERR PREFIX "Invalid _TSD data\n");
+               pr_err("Invalid _TSD data\n");
                result = -EFAULT;
                goto end;
        }
 
        if (tsd->package.count != 1) {
-               printk(KERN_ERR PREFIX "Invalid _TSD data\n");
+               pr_err("Invalid _TSD data\n");
                result = -EFAULT;
                goto end;
        }
@@ -604,19 +600,19 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr)
        status = acpi_extract_package(&(tsd->package.elements[0]),
                                      &format, &state);
        if (ACPI_FAILURE(status)) {
-               printk(KERN_ERR PREFIX "Invalid _TSD data\n");
+               pr_err("Invalid _TSD data\n");
                result = -EFAULT;
                goto end;
        }
 
        if (pdomain->num_entries != ACPI_TSD_REV0_ENTRIES) {
-               printk(KERN_ERR PREFIX "Unknown _TSD:num_entries\n");
+               pr_err("Unknown _TSD:num_entries\n");
                result = -EFAULT;
                goto end;
        }
 
        if (pdomain->revision != ACPI_TSD_REV0_REVISION) {
-               printk(KERN_ERR PREFIX "Unknown _TSD:revision\n");
+               pr_err("Unknown _TSD:revision\n");
                result = -EFAULT;
                goto end;
        }
@@ -709,8 +705,7 @@ static int acpi_throttling_rdmsr(u64 *value)
 
        if ((this_cpu_read(cpu_info.x86_vendor) != X86_VENDOR_INTEL) ||
                !this_cpu_has(X86_FEATURE_ACPI)) {
-               printk(KERN_ERR PREFIX
-                       "HARDWARE addr space,NOT supported yet\n");
+               pr_err("HARDWARE addr space,NOT supported yet\n");
        } else {
                msr_low = 0;
                msr_high = 0;
@@ -730,8 +725,7 @@ static int acpi_throttling_wrmsr(u64 value)
 
        if ((this_cpu_read(cpu_info.x86_vendor) != X86_VENDOR_INTEL) ||
                !this_cpu_has(X86_FEATURE_ACPI)) {
-               printk(KERN_ERR PREFIX
-                       "HARDWARE addr space,NOT supported yet\n");
+               pr_err("HARDWARE addr space,NOT supported yet\n");
        } else {
                msr = value;
                wrmsr_safe(MSR_IA32_THERM_CONTROL,
@@ -743,15 +737,13 @@ static int acpi_throttling_wrmsr(u64 value)
 #else
 static int acpi_throttling_rdmsr(u64 *value)
 {
-       printk(KERN_ERR PREFIX
-               "HARDWARE addr space,NOT supported yet\n");
+       pr_err("HARDWARE addr space,NOT supported yet\n");
        return -1;
 }
 
 static int acpi_throttling_wrmsr(u64 value)
 {
-       printk(KERN_ERR PREFIX
-               "HARDWARE addr space,NOT supported yet\n");
+       pr_err("HARDWARE addr space,NOT supported yet\n");
        return -1;
 }
 #endif
@@ -782,7 +774,7 @@ static int acpi_read_throttling_status(struct acpi_processor *pr,
                ret = acpi_throttling_rdmsr(value);
                break;
        default:
-               printk(KERN_ERR PREFIX "Unknown addr space %d\n",
+               pr_err("Unknown addr space %d\n",
                       (u32) (throttling->status_register.space_id));
        }
        return ret;
@@ -815,7 +807,7 @@ static int acpi_write_throttling_state(struct acpi_processor *pr,
                ret = acpi_throttling_wrmsr(value);
                break;
        default:
-               printk(KERN_ERR PREFIX "Unknown addr space %d\n",
+               pr_err("Unknown addr space %d\n",
                       (u32) (throttling->control_register.space_id));
        }
        return ret;
@@ -924,7 +916,7 @@ static int acpi_processor_get_fadt_info(struct acpi_processor *pr)
        }
        /* TBD: Support duty_cycle values that span bit 4. */
        else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) {
-               printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n");
+               pr_warn("duty_cycle spans bit 4\n");
                return -EINVAL;
        }