aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/acpica/tbxface.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index 5217a6159a31..684614d0d327 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -172,6 +172,7 @@ acpi_status acpi_reallocate_root_table(void)
172{ 172{
173 struct acpi_table_desc *tables; 173 struct acpi_table_desc *tables;
174 acpi_size new_size; 174 acpi_size new_size;
175 acpi_size current_size;
175 176
176 ACPI_FUNCTION_TRACE(acpi_reallocate_root_table); 177 ACPI_FUNCTION_TRACE(acpi_reallocate_root_table);
177 178
@@ -183,9 +184,15 @@ acpi_status acpi_reallocate_root_table(void)
183 return_ACPI_STATUS(AE_SUPPORT); 184 return_ACPI_STATUS(AE_SUPPORT);
184 } 185 }
185 186
186 new_size = ((acpi_size) acpi_gbl_root_table_list.count + 187 /*
187 ACPI_ROOT_TABLE_SIZE_INCREMENT) * 188 * Get the current size of the root table and add the default
188 sizeof(struct acpi_table_desc); 189 * increment to create the new table size.
190 */
191 current_size = (acpi_size)
192 acpi_gbl_root_table_list.count * sizeof(struct acpi_table_desc);
193
194 new_size = current_size +
195 (ACPI_ROOT_TABLE_SIZE_INCREMENT * sizeof(struct acpi_table_desc));
189 196
190 /* Create new array and copy the old array */ 197 /* Create new array and copy the old array */
191 198
@@ -194,10 +201,16 @@ acpi_status acpi_reallocate_root_table(void)
194 return_ACPI_STATUS(AE_NO_MEMORY); 201 return_ACPI_STATUS(AE_NO_MEMORY);
195 } 202 }
196 203
197 ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, new_size); 204 ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, current_size);
198 205
199 acpi_gbl_root_table_list.size = acpi_gbl_root_table_list.count; 206 /*
207 * Update the root table descriptor. The new size will be the current
208 * number of tables plus the increment, independent of the reserved
209 * size of the original table list.
210 */
200 acpi_gbl_root_table_list.tables = tables; 211 acpi_gbl_root_table_list.tables = tables;
212 acpi_gbl_root_table_list.size =
213 acpi_gbl_root_table_list.count + ACPI_ROOT_TABLE_SIZE_INCREMENT;
201 acpi_gbl_root_table_list.flags = 214 acpi_gbl_root_table_list.flags =
202 ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE; 215 ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE;
203 216