diff options
author | Len Brown <len.brown@intel.com> | 2009-04-05 01:39:00 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-04-05 01:39:00 -0400 |
commit | a3b2c5e413ce500d19cb776662ae0ea405cdd994 (patch) | |
tree | dd226b6299da0b6f7a47f4e01e2f4767a0ff7309 /drivers/acpi/system.c | |
parent | 493837009665a5ea1d91ed5fe4bab0ed546cae86 (diff) | |
parent | 4658e4ef9d252c26630268b20ceab78b3952db41 (diff) |
Merge branch 'dynamic-ssdt' into release
Diffstat (limited to 'drivers/acpi/system.c')
-rw-r--r-- | drivers/acpi/system.c | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 3b88981dd215..44be75ee7264 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -62,6 +62,7 @@ module_param_call(acpica_version, NULL, param_get_acpica_version, NULL, 0444); | |||
62 | -------------------------------------------------------------------------- */ | 62 | -------------------------------------------------------------------------- */ |
63 | static LIST_HEAD(acpi_table_attr_list); | 63 | static LIST_HEAD(acpi_table_attr_list); |
64 | static struct kobject *tables_kobj; | 64 | static struct kobject *tables_kobj; |
65 | static struct kobject *dynamic_tables_kobj; | ||
65 | 66 | ||
66 | struct acpi_table_attr { | 67 | struct acpi_table_attr { |
67 | struct bin_attribute attr; | 68 | struct bin_attribute attr; |
@@ -128,6 +129,40 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr, | |||
128 | return; | 129 | return; |
129 | } | 130 | } |
130 | 131 | ||
132 | static acpi_status | ||
133 | acpi_sysfs_table_handler(u32 event, void *table, void *context) | ||
134 | { | ||
135 | struct acpi_table_attr *table_attr; | ||
136 | |||
137 | switch (event) { | ||
138 | case ACPI_TABLE_EVENT_LOAD: | ||
139 | table_attr = | ||
140 | kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL); | ||
141 | if (!table_attr) | ||
142 | return AE_NO_MEMORY; | ||
143 | |||
144 | acpi_table_attr_init(table_attr, table); | ||
145 | if (sysfs_create_bin_file(dynamic_tables_kobj, | ||
146 | &table_attr->attr)) { | ||
147 | kfree(table_attr); | ||
148 | return AE_ERROR; | ||
149 | } else | ||
150 | list_add_tail(&table_attr->node, | ||
151 | &acpi_table_attr_list); | ||
152 | break; | ||
153 | case ACPI_TABLE_EVENT_UNLOAD: | ||
154 | /* | ||
155 | * we do not need to do anything right now | ||
156 | * because the table is not deleted from the | ||
157 | * global table list when unloading it. | ||
158 | */ | ||
159 | break; | ||
160 | default: | ||
161 | return AE_BAD_PARAMETER; | ||
162 | } | ||
163 | return AE_OK; | ||
164 | } | ||
165 | |||
131 | static int acpi_system_sysfs_init(void) | 166 | static int acpi_system_sysfs_init(void) |
132 | { | 167 | { |
133 | struct acpi_table_attr *table_attr; | 168 | struct acpi_table_attr *table_attr; |
@@ -137,7 +172,11 @@ static int acpi_system_sysfs_init(void) | |||
137 | 172 | ||
138 | tables_kobj = kobject_create_and_add("tables", acpi_kobj); | 173 | tables_kobj = kobject_create_and_add("tables", acpi_kobj); |
139 | if (!tables_kobj) | 174 | if (!tables_kobj) |
140 | return -ENOMEM; | 175 | goto err; |
176 | |||
177 | dynamic_tables_kobj = kobject_create_and_add("dynamic", tables_kobj); | ||
178 | if (!dynamic_tables_kobj) | ||
179 | goto err_dynamic_tables; | ||
141 | 180 | ||
142 | do { | 181 | do { |
143 | result = acpi_get_table_by_index(table_index, &table_header); | 182 | result = acpi_get_table_by_index(table_index, &table_header); |
@@ -162,8 +201,14 @@ static int acpi_system_sysfs_init(void) | |||
162 | } | 201 | } |
163 | } while (!result); | 202 | } while (!result); |
164 | kobject_uevent(tables_kobj, KOBJ_ADD); | 203 | kobject_uevent(tables_kobj, KOBJ_ADD); |
165 | 204 | kobject_uevent(dynamic_tables_kobj, KOBJ_ADD); | |
166 | return 0; | 205 | result = acpi_install_table_handler(acpi_sysfs_table_handler, NULL); |
206 | |||
207 | return result == AE_OK ? 0 : -EINVAL; | ||
208 | err_dynamic_tables: | ||
209 | kobject_put(tables_kobj); | ||
210 | err: | ||
211 | return -ENOMEM; | ||
167 | } | 212 | } |
168 | 213 | ||
169 | /* | 214 | /* |