提交 74cad4ee 编写于 作者: Z Zhao Yakui 提交者: Len Brown

ACPI: Make ACPI processor proc I/F depend on the ACPI_PROCFS

Now whether the ACPI processor proc I/F is registered depends on the
CONFIG_PROC. It had better depend on the CONFIG_ACPI_PROCFS.
When the CONFIG_ACPI_PROCFS is unset in kernel configuration, the
ACPI processor proc I/F won't be registered.
Signed-off-by: NZhao Yakui <yakui.zhao@intel.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 07a2039b
...@@ -60,7 +60,11 @@ config ACPI_PROCFS ...@@ -60,7 +60,11 @@ config ACPI_PROCFS
/proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP)
/proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer)
/proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level) /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level)
/proc/acpi/processor/*/power (/sys/devices/system/cpu/*/cpuidle/*)
/proc/acpi/processor/*/performance (/sys/devices/system/cpu/*/
cpufreq/*)
/proc/acpi/processor/*/throttling (/sys/class/thermal/
cooling_device*/*)
This option has no effect on /proc/acpi/ files This option has no effect on /proc/acpi/ files
and functions which do not yet exist in /sys. and functions which do not yet exist in /sys.
......
...@@ -81,7 +81,9 @@ MODULE_LICENSE("GPL"); ...@@ -81,7 +81,9 @@ MODULE_LICENSE("GPL");
static int acpi_processor_add(struct acpi_device *device); static int acpi_processor_add(struct acpi_device *device);
static int acpi_processor_start(struct acpi_device *device); static int acpi_processor_start(struct acpi_device *device);
static int acpi_processor_remove(struct acpi_device *device, int type); static int acpi_processor_remove(struct acpi_device *device, int type);
#ifdef CONFIG_ACPI_PROCFS
static int acpi_processor_info_open_fs(struct inode *inode, struct file *file); static int acpi_processor_info_open_fs(struct inode *inode, struct file *file);
#endif
static void acpi_processor_notify(struct acpi_device *device, u32 event); static void acpi_processor_notify(struct acpi_device *device, u32 event);
static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu);
static int acpi_processor_handle_eject(struct acpi_processor *pr); static int acpi_processor_handle_eject(struct acpi_processor *pr);
...@@ -110,7 +112,7 @@ static struct acpi_driver acpi_processor_driver = { ...@@ -110,7 +112,7 @@ static struct acpi_driver acpi_processor_driver = {
#define INSTALL_NOTIFY_HANDLER 1 #define INSTALL_NOTIFY_HANDLER 1
#define UNINSTALL_NOTIFY_HANDLER 2 #define UNINSTALL_NOTIFY_HANDLER 2
#ifdef CONFIG_ACPI_PROCFS
static const struct file_operations acpi_processor_info_fops = { static const struct file_operations acpi_processor_info_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = acpi_processor_info_open_fs, .open = acpi_processor_info_open_fs,
...@@ -118,6 +120,7 @@ static const struct file_operations acpi_processor_info_fops = { ...@@ -118,6 +120,7 @@ static const struct file_operations acpi_processor_info_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
#endif
DEFINE_PER_CPU(struct acpi_processor *, processors); DEFINE_PER_CPU(struct acpi_processor *, processors);
struct acpi_processor_errata errata __read_mostly; struct acpi_processor_errata errata __read_mostly;
...@@ -316,6 +319,7 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr) ...@@ -316,6 +319,7 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr)
FS Interface (/proc) FS Interface (/proc)
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_PROCFS
static struct proc_dir_entry *acpi_processor_dir = NULL; static struct proc_dir_entry *acpi_processor_dir = NULL;
static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset)
...@@ -388,7 +392,6 @@ static int acpi_processor_add_fs(struct acpi_device *device) ...@@ -388,7 +392,6 @@ static int acpi_processor_add_fs(struct acpi_device *device)
return -EIO; return -EIO;
return 0; return 0;
} }
static int acpi_processor_remove_fs(struct acpi_device *device) static int acpi_processor_remove_fs(struct acpi_device *device)
{ {
...@@ -405,6 +408,16 @@ static int acpi_processor_remove_fs(struct acpi_device *device) ...@@ -405,6 +408,16 @@ static int acpi_processor_remove_fs(struct acpi_device *device)
return 0; return 0;
} }
#else
static inline int acpi_processor_add_fs(struct acpi_device *device)
{
return 0;
}
static inline int acpi_processor_remove_fs(struct acpi_device *device)
{
return 0;
}
#endif
/* Use the acpiid in MADT to map cpus in case of SMP */ /* Use the acpiid in MADT to map cpus in case of SMP */
...@@ -1147,11 +1160,11 @@ static int __init acpi_processor_init(void) ...@@ -1147,11 +1160,11 @@ static int __init acpi_processor_init(void)
(struct acpi_table_header **)&madt))) (struct acpi_table_header **)&madt)))
madt = NULL; madt = NULL;
#endif #endif
#ifdef CONFIG_ACPI_PROCFS
acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
if (!acpi_processor_dir) if (!acpi_processor_dir)
return -ENOMEM; return -ENOMEM;
#endif
/* /*
* Check whether the system is DMI table. If yes, OSPM * Check whether the system is DMI table. If yes, OSPM
* should not use mwait for CPU-states. * should not use mwait for CPU-states.
...@@ -1179,7 +1192,9 @@ static int __init acpi_processor_init(void) ...@@ -1179,7 +1192,9 @@ static int __init acpi_processor_init(void)
cpuidle_unregister_driver(&acpi_idle_driver); cpuidle_unregister_driver(&acpi_idle_driver);
out_proc: out_proc:
#ifdef CONFIG_ACPI_PROCFS
remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
#endif
return result; return result;
} }
...@@ -1196,7 +1211,9 @@ static void __exit acpi_processor_exit(void) ...@@ -1196,7 +1211,9 @@ static void __exit acpi_processor_exit(void)
cpuidle_unregister_driver(&acpi_idle_driver); cpuidle_unregister_driver(&acpi_idle_driver);
#ifdef CONFIG_ACPI_PROCFS
remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
#endif
return; return;
} }
......
...@@ -679,6 +679,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) ...@@ -679,6 +679,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
return 0; return 0;
} }
#ifdef CONFIG_ACPI_PROCFS
static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_processor *pr = seq->private; struct acpi_processor *pr = seq->private;
...@@ -758,7 +759,7 @@ static const struct file_operations acpi_processor_power_fops = { ...@@ -758,7 +759,7 @@ static const struct file_operations acpi_processor_power_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
#endif
/** /**
* acpi_idle_bm_check - checks if bus master activity was detected * acpi_idle_bm_check - checks if bus master activity was detected
...@@ -1216,7 +1217,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, ...@@ -1216,7 +1217,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
pr->power.states[i].type); pr->power.states[i].type);
printk(")\n"); printk(")\n");
} }
#ifdef CONFIG_ACPI_PROCFS
/* 'power' [R] */ /* 'power' [R] */
entry = proc_create_data(ACPI_PROCESSOR_FILE_POWER, entry = proc_create_data(ACPI_PROCESSOR_FILE_POWER,
S_IRUGO, acpi_device_dir(device), S_IRUGO, acpi_device_dir(device),
...@@ -1224,6 +1225,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, ...@@ -1224,6 +1225,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
acpi_driver_data(device)); acpi_driver_data(device));
if (!entry) if (!entry)
return -EIO; return -EIO;
#endif
return 0; return 0;
} }
...@@ -1236,9 +1238,11 @@ int acpi_processor_power_exit(struct acpi_processor *pr, ...@@ -1236,9 +1238,11 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
cpuidle_unregister_device(&pr->power.dev); cpuidle_unregister_device(&pr->power.dev);
pr->flags.power_setup_done = 0; pr->flags.power_setup_done = 0;
#ifdef CONFIG_ACPI_PROCFS
if (acpi_device_dir(device)) if (acpi_device_dir(device))
remove_proc_entry(ACPI_PROCESSOR_FILE_POWER, remove_proc_entry(ACPI_PROCESSOR_FILE_POWER,
acpi_device_dir(device)); acpi_device_dir(device));
#endif
return 0; return 0;
} }
...@@ -438,7 +438,7 @@ struct thermal_cooling_device_ops processor_cooling_ops = { ...@@ -438,7 +438,7 @@ struct thermal_cooling_device_ops processor_cooling_ops = {
}; };
/* /proc interface */ /* /proc interface */
#ifdef CONFIG_ACPI_PROCFS
static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset)
{ {
struct acpi_processor *pr = (struct acpi_processor *)seq->private; struct acpi_processor *pr = (struct acpi_processor *)seq->private;
...@@ -517,3 +517,4 @@ const struct file_operations acpi_processor_limit_fops = { ...@@ -517,3 +517,4 @@ const struct file_operations acpi_processor_limit_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
#endif
...@@ -1214,7 +1214,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) ...@@ -1214,7 +1214,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
} }
/* proc interface */ /* proc interface */
#ifdef CONFIG_ACPI_PROCFS
static int acpi_processor_throttling_seq_show(struct seq_file *seq, static int acpi_processor_throttling_seq_show(struct seq_file *seq,
void *offset) void *offset)
{ {
...@@ -1322,3 +1322,4 @@ const struct file_operations acpi_processor_throttling_fops = { ...@@ -1322,3 +1322,4 @@ const struct file_operations acpi_processor_throttling_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册