aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/tbinstal.c
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2012-09-13 12:29:06 -0400
committerLen Brown <len.brown@intel.com>2012-09-21 00:35:12 -0400
commit2bc198c1527be998850ade8f91ec7d340b67fdf3 (patch)
treef3164a231795968c125aa7a4e6f38850462076d9 /drivers/acpi/acpica/tbinstal.c
parentca4a03143f6c911189f708a3a3c7eae3dfb8678c (diff)
ACPICA: Table Manager: Merge duplicate code (root table)
Merge/remove duplicate code in the root table resize functions One function is external, the other is internal. Lv Zheng, ACPICA BZ 846: https://acpica.org/bugzilla/show_bug.cgi?id=846 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/tbinstal.c')
-rw-r--r--drivers/acpi/acpica/tbinstal.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index 74f97d74db1c..70f9d787c82c 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -350,6 +350,7 @@ struct acpi_table_header *acpi_tb_table_override(struct acpi_table_header
350acpi_status acpi_tb_resize_root_table_list(void) 350acpi_status acpi_tb_resize_root_table_list(void)
351{ 351{
352 struct acpi_table_desc *tables; 352 struct acpi_table_desc *tables;
353 u32 table_count;
353 354
354 ACPI_FUNCTION_TRACE(tb_resize_root_table_list); 355 ACPI_FUNCTION_TRACE(tb_resize_root_table_list);
355 356
@@ -363,8 +364,13 @@ acpi_status acpi_tb_resize_root_table_list(void)
363 364
364 /* Increase the Table Array size */ 365 /* Increase the Table Array size */
365 366
366 tables = ACPI_ALLOCATE_ZEROED(((acpi_size) acpi_gbl_root_table_list. 367 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
367 max_table_count + 368 table_count = acpi_gbl_root_table_list.max_table_count;
369 } else {
370 table_count = acpi_gbl_root_table_list.current_table_count;
371 }
372
373 tables = ACPI_ALLOCATE_ZEROED(((acpi_size) table_count +
368 ACPI_ROOT_TABLE_SIZE_INCREMENT) * 374 ACPI_ROOT_TABLE_SIZE_INCREMENT) *
369 sizeof(struct acpi_table_desc)); 375 sizeof(struct acpi_table_desc));
370 if (!tables) { 376 if (!tables) {
@@ -377,8 +383,8 @@ acpi_status acpi_tb_resize_root_table_list(void)
377 383
378 if (acpi_gbl_root_table_list.tables) { 384 if (acpi_gbl_root_table_list.tables) {
379 ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, 385 ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables,
380 (acpi_size) acpi_gbl_root_table_list. 386 (acpi_size) table_count *
381 max_table_count * sizeof(struct acpi_table_desc)); 387 sizeof(struct acpi_table_desc));
382 388
383 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { 389 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
384 ACPI_FREE(acpi_gbl_root_table_list.tables); 390 ACPI_FREE(acpi_gbl_root_table_list.tables);
@@ -386,9 +392,9 @@ acpi_status acpi_tb_resize_root_table_list(void)
386 } 392 }
387 393
388 acpi_gbl_root_table_list.tables = tables; 394 acpi_gbl_root_table_list.tables = tables;
389 acpi_gbl_root_table_list.max_table_count += 395 acpi_gbl_root_table_list.max_table_count =
390 ACPI_ROOT_TABLE_SIZE_INCREMENT; 396 table_count + ACPI_ROOT_TABLE_SIZE_INCREMENT;
391 acpi_gbl_root_table_list.flags |= (u8)ACPI_ROOT_ORIGIN_ALLOCATED; 397 acpi_gbl_root_table_list.flags |= ACPI_ROOT_ORIGIN_ALLOCATED;
392 398
393 return_ACPI_STATUS(AE_OK); 399 return_ACPI_STATUS(AE_OK);
394} 400}