diff options
author | Ingo Molnar <mingo@kernel.org> | 2014-01-05 06:34:29 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-01-05 06:34:29 -0500 |
commit | ef0b8b9a521c65201bfca9747ee1bf374296133c (patch) | |
tree | 644c3390c07d06fb7807182a4935f7c3f675b157 /drivers/acpi/sysfs.c | |
parent | 5c12af0c41e3417e1939095325920463b5f8e726 (diff) | |
parent | d6e0a2dd12f4067a5bcefb8bbd8ddbeff800afbc (diff) |
Merge tag 'v3.13-rc7' into x86/efi-kexec to resolve conflicts
Conflicts:
arch/x86/platform/efi/efi.c
drivers/firmware/efi/Kconfig
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/acpi/sysfs.c')
-rw-r--r-- | drivers/acpi/sysfs.c | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index db5293650f62..6dbc3ca45223 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
@@ -309,7 +309,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr, | |||
309 | sprintf(table_attr->name + ACPI_NAME_SIZE, "%d", | 309 | sprintf(table_attr->name + ACPI_NAME_SIZE, "%d", |
310 | table_attr->instance); | 310 | table_attr->instance); |
311 | 311 | ||
312 | table_attr->attr.size = 0; | 312 | table_attr->attr.size = table_header->length; |
313 | table_attr->attr.read = acpi_table_show; | 313 | table_attr->attr.read = acpi_table_show; |
314 | table_attr->attr.attr.name = table_attr->name; | 314 | table_attr->attr.attr.name = table_attr->name; |
315 | table_attr->attr.attr.mode = 0400; | 315 | table_attr->attr.attr.mode = 0400; |
@@ -354,8 +354,9 @@ static int acpi_tables_sysfs_init(void) | |||
354 | { | 354 | { |
355 | struct acpi_table_attr *table_attr; | 355 | struct acpi_table_attr *table_attr; |
356 | struct acpi_table_header *table_header = NULL; | 356 | struct acpi_table_header *table_header = NULL; |
357 | int table_index = 0; | 357 | int table_index; |
358 | int result; | 358 | acpi_status status; |
359 | int ret; | ||
359 | 360 | ||
360 | tables_kobj = kobject_create_and_add("tables", acpi_kobj); | 361 | tables_kobj = kobject_create_and_add("tables", acpi_kobj); |
361 | if (!tables_kobj) | 362 | if (!tables_kobj) |
@@ -365,33 +366,34 @@ static int acpi_tables_sysfs_init(void) | |||
365 | if (!dynamic_tables_kobj) | 366 | if (!dynamic_tables_kobj) |
366 | goto err_dynamic_tables; | 367 | goto err_dynamic_tables; |
367 | 368 | ||
368 | do { | 369 | for (table_index = 0;; table_index++) { |
369 | result = acpi_get_table_by_index(table_index, &table_header); | 370 | status = acpi_get_table_by_index(table_index, &table_header); |
370 | if (!result) { | 371 | |
371 | table_index++; | 372 | if (status == AE_BAD_PARAMETER) |
372 | table_attr = NULL; | 373 | break; |
373 | table_attr = | 374 | |
374 | kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL); | 375 | if (ACPI_FAILURE(status)) |
375 | if (!table_attr) | 376 | continue; |
376 | return -ENOMEM; | 377 | |
377 | 378 | table_attr = NULL; | |
378 | acpi_table_attr_init(table_attr, table_header); | 379 | table_attr = kzalloc(sizeof(*table_attr), GFP_KERNEL); |
379 | result = | 380 | if (!table_attr) |
380 | sysfs_create_bin_file(tables_kobj, | 381 | return -ENOMEM; |
381 | &table_attr->attr); | 382 | |
382 | if (result) { | 383 | acpi_table_attr_init(table_attr, table_header); |
383 | kfree(table_attr); | 384 | ret = sysfs_create_bin_file(tables_kobj, &table_attr->attr); |
384 | return result; | 385 | if (ret) { |
385 | } else | 386 | kfree(table_attr); |
386 | list_add_tail(&table_attr->node, | 387 | return ret; |
387 | &acpi_table_attr_list); | ||
388 | } | 388 | } |
389 | } while (!result); | 389 | list_add_tail(&table_attr->node, &acpi_table_attr_list); |
390 | } | ||
391 | |||
390 | kobject_uevent(tables_kobj, KOBJ_ADD); | 392 | kobject_uevent(tables_kobj, KOBJ_ADD); |
391 | kobject_uevent(dynamic_tables_kobj, KOBJ_ADD); | 393 | kobject_uevent(dynamic_tables_kobj, KOBJ_ADD); |
392 | result = acpi_install_table_handler(acpi_sysfs_table_handler, NULL); | 394 | status = acpi_install_table_handler(acpi_sysfs_table_handler, NULL); |
393 | 395 | ||
394 | return result == AE_OK ? 0 : -EINVAL; | 396 | return ACPI_FAILURE(status) ? -EINVAL : 0; |
395 | err_dynamic_tables: | 397 | err_dynamic_tables: |
396 | kobject_put(tables_kobj); | 398 | kobject_put(tables_kobj); |
397 | err: | 399 | err: |