From 5bb730fda8aa4e3f7e94b259c468ecd095f60770 Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Mon, 29 Jan 2007 11:02:42 +0800 Subject: [PATCH] ACPI: add ACPICA version in sysfs Add an ACPI attribute to indicate ACPICA version. /proc/acpi/version is deprecated by /sys/module/acpi/parameters/acpica_version. Signed-off-by: Zhang Rui Signed-off-by: Len Brown --- drivers/acpi/Kconfig | 4 +++- drivers/acpi/system.c | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index a3a10737d72f..df4514436ba8 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -87,7 +87,9 @@ config ACPI_PROCFS and this proc interface will be removed some time later, it's marked as deprecated. ( /proc/acpi/debug_layer && debug_level are deprecated by - /sys/module/acpi/parameters/debug_layer && debug_level. ) + /sys/module/acpi/parameters/debug_layer && debug_level. + /proc/acpi/info is deprecated by + /sys/module/acpi/parameters/acpica_version ) config ACPI_AC tristate "AC Adapter" diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index d86dcb3c2366..407b0e0281db 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c @@ -32,6 +32,11 @@ #define _COMPONENT ACPI_SYSTEM_COMPONENT ACPI_MODULE_NAME("acpi_system") +#ifdef MODULE_PARAM_PREFIX +#undef MODULE_PARAM_PREFIX +#endif +#define MODULE_PARAM_PREFIX "acpi." + #define ACPI_SYSTEM_CLASS "system" #define ACPI_SYSTEM_DRIVER_NAME "ACPI System Driver" #define ACPI_SYSTEM_DEVICE_NAME "System" @@ -41,9 +46,23 @@ ACPI_MODULE_NAME("acpi_system") #define ACPI_SYSTEM_FILE_FADT "fadt" extern struct fadt_descriptor acpi_fadt; +/* + * Make ACPICA version work as module param + */ +static int param_get_acpica_version(char *buffer, struct kernel_param *kp) { + int result; + + result = sprintf(buffer, "%x", ACPI_CA_VERSION); + + return result; +} + +module_param_call(acpica_version, NULL, param_get_acpica_version, NULL, 0444); + /* -------------------------------------------------------------------------- FS Interface (/proc) -------------------------------------------------------------------------- */ +#ifdef CONFIG_ACPI_PROCFS static int acpi_system_read_info(struct seq_file *seq, void *offset) { @@ -63,6 +82,7 @@ static const struct file_operations acpi_system_info_ops = { .llseek = seq_lseek, .release = single_release, }; +#endif static ssize_t acpi_system_read_dsdt(struct file *, char __user *, size_t, loff_t *); @@ -128,6 +148,7 @@ static int __init acpi_system_init(void) if (acpi_disabled) return 0; +#ifdef CONFIG_ACPI_PROCFS /* 'info' [R] */ name = ACPI_SYSTEM_FILE_INFO; entry = create_proc_entry(name, S_IRUGO, acpi_root_dir); @@ -136,6 +157,7 @@ static int __init acpi_system_init(void) else { entry->proc_fops = &acpi_system_info_ops; } +#endif /* 'dsdt' [R] */ name = ACPI_SYSTEM_FILE_DSDT; @@ -159,7 +181,9 @@ static int __init acpi_system_init(void) Error: remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_DSDT, acpi_root_dir); +#ifdef CONFIG_ACPI_PROCFS remove_proc_entry(ACPI_SYSTEM_FILE_INFO, acpi_root_dir); +#endif error = -EFAULT; goto Done; -- 2.20.1