diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-05 22:16:25 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-05 22:16:25 +0400 |
commit | 32fb6c17566ec66de87324a834c7776f40e35e78 (patch) | |
tree | 87b8ed5d66495536fbb452255c3eacd1cfb0c43a /drivers/acpi/system.c | |
parent | 45e36c1666aa6c8b0c538abcf984b336184d8c3f (diff) | |
parent | 7ec0a7290797f57b780f792d12f4bcc19c83aa4f (diff) | |
download | linux-32fb6c17566ec66de87324a834c7776f40e35e78.tar.xz |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (140 commits)
ACPI: processor: use .notify method instead of installing handler directly
ACPI: button: use .notify method instead of installing handler directly
ACPI: support acpi_device_ops .notify methods
toshiba-acpi: remove MAINTAINERS entry
ACPI: battery: asynchronous init
acer-wmi: Update copyright notice & documentation
acer-wmi: Cleanup the failure cleanup handling
acer-wmi: Blacklist Acer Aspire One
video: build fix
thinkpad-acpi: rework brightness support
thinkpad-acpi: enhanced debugging messages for the fan subdriver
thinkpad-acpi: enhanced debugging messages for the hotkey subdriver
thinkpad-acpi: enhanced debugging messages for rfkill subdrivers
thinkpad-acpi: restrict access to some firmware LEDs
thinkpad-acpi: remove HKEY disable functionality
thinkpad-acpi: add new debug helpers and warn of deprecated atts
thinkpad-acpi: add missing log levels
thinkpad-acpi: cleanup debug helpers
thinkpad-acpi: documentation cleanup
thinkpad-acpi: drop ibm-acpi alias
...
Diffstat (limited to 'drivers/acpi/system.c')
-rw-r--r-- | drivers/acpi/system.c | 64 |
1 files changed, 50 insertions, 14 deletions
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 391d0358a592..da51f05ef8d8 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c @@ -33,10 +33,6 @@ #define _COMPONENT ACPI_SYSTEM_COMPONENT ACPI_MODULE_NAME("system"); -#ifdef MODULE_PARAM_PREFIX -#undef MODULE_PARAM_PREFIX -#endif -#define MODULE_PARAM_PREFIX "acpi." #define ACPI_SYSTEM_CLASS "system" #define ACPI_SYSTEM_DEVICE_NAME "System" @@ -62,6 +58,7 @@ module_param_call(acpica_version, NULL, param_get_acpica_version, NULL, 0444); -------------------------------------------------------------------------- */ static LIST_HEAD(acpi_table_attr_list); static struct kobject *tables_kobj; +static struct kobject *dynamic_tables_kobj; struct acpi_table_attr { struct bin_attribute attr; @@ -128,6 +125,40 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr, return; } +static acpi_status +acpi_sysfs_table_handler(u32 event, void *table, void *context) +{ + struct acpi_table_attr *table_attr; + + switch (event) { + case ACPI_TABLE_EVENT_LOAD: + table_attr = + kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL); + if (!table_attr) + return AE_NO_MEMORY; + + acpi_table_attr_init(table_attr, table); + if (sysfs_create_bin_file(dynamic_tables_kobj, + &table_attr->attr)) { + kfree(table_attr); + return AE_ERROR; + } else + list_add_tail(&table_attr->node, + &acpi_table_attr_list); + break; + case ACPI_TABLE_EVENT_UNLOAD: + /* + * we do not need to do anything right now + * because the table is not deleted from the + * global table list when unloading it. + */ + break; + default: + return AE_BAD_PARAMETER; + } + return AE_OK; +} + static int acpi_system_sysfs_init(void) { struct acpi_table_attr *table_attr; @@ -137,7 +168,11 @@ static int acpi_system_sysfs_init(void) tables_kobj = kobject_create_and_add("tables", acpi_kobj); if (!tables_kobj) - return -ENOMEM; + goto err; + + dynamic_tables_kobj = kobject_create_and_add("dynamic", tables_kobj); + if (!dynamic_tables_kobj) + goto err_dynamic_tables; do { result = acpi_get_table_by_index(table_index, &table_header); @@ -162,8 +197,14 @@ static int acpi_system_sysfs_init(void) } } while (!result); kobject_uevent(tables_kobj, KOBJ_ADD); - - return 0; + kobject_uevent(dynamic_tables_kobj, KOBJ_ADD); + result = acpi_install_table_handler(acpi_sysfs_table_handler, NULL); + + return result == AE_OK ? 0 : -EINVAL; +err_dynamic_tables: + kobject_put(tables_kobj); +err: + return -ENOMEM; } /* @@ -571,12 +612,9 @@ static int acpi_system_procfs_init(void) } #endif -static int __init acpi_system_init(void) +int __init acpi_system_init(void) { - int result = 0; - - if (acpi_disabled) - return 0; + int result; result = acpi_system_procfs_init(); if (result) @@ -586,5 +624,3 @@ static int __init acpi_system_init(void) return result; } - -subsys_initcall(acpi_system_init); |