[PATCH] ACPI: create proc entry 'power' only if C2 or C3 issupported

From: Yi Yang
Date: Thu Jan 24 2008 - 04:58:59 EST


Subject: ACPI: Create proc entry 'power' only C2 or C3 is supported
From: Yi Yang <yi.y.yang@xxxxxxxxx>

ACPI processor idle driver makes sense only if the processor supports
C2 or C3. For legacy C0 and C1, just the original pm_idle is working
, statistics info about promotion, demotion, latency, usage and
duration are empty or 0, so these are misleading, users'll think their
CPUs support C states (C2 or C3), /proc/acpi/processor/CPU*/power
shouldn't exist for this case at all.

This patch fixes this issue, it makes ACPI processor idle driver to create
proc entry only if the processor supports C2 or C3.


Signed-off-by: Yi Yang <yi.y.yang@xxxxxxxxx>
---
processor_idle.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

--- a/drivers/acpi/processor_idle.c 2008-01-24 05:34:29.000000000 +0800
+++ b/drivers/acpi/processor_idle.c 2008-01-24 07:04:59.000000000 +0800
@@ -1738,17 +1738,17 @@ int __cpuinit acpi_processor_power_init(
pm_idle = acpi_processor_idle;
}
#endif
- }

- /* 'power' [R] */
- entry = create_proc_entry(ACPI_PROCESSOR_FILE_POWER,
- S_IRUGO, acpi_device_dir(device));
- if (!entry)
- return -EIO;
- else {
- entry->proc_fops = &acpi_processor_power_fops;
- entry->data = acpi_driver_data(device);
- entry->owner = THIS_MODULE;
+ /* 'power' [R] */
+ entry = create_proc_entry(ACPI_PROCESSOR_FILE_POWER,
+ S_IRUGO, acpi_device_dir(device));
+ if (!entry)
+ return -EIO;
+ else {
+ entry->proc_fops = &acpi_processor_power_fops;
+ entry->data = acpi_driver_data(device);
+ entry->owner = THIS_MODULE;
+ }
}

return 0;
@@ -1763,7 +1763,8 @@ int acpi_processor_power_exit(struct acp
#endif
pr->flags.power_setup_done = 0;

- if (acpi_device_dir(device))
+ if (acpi_device_dir(device) &&
+ ((pr->flags.power) && (!boot_option_idle_override)))
remove_proc_entry(ACPI_PROCESSOR_FILE_POWER,
acpi_device_dir(device));



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/