aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rscalc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/resources/rscalc.c')
-rw-r--r--drivers/acpi/resources/rscalc.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c
index 7d6481d9fbec..223bdc493269 100644
--- a/drivers/acpi/resources/rscalc.c
+++ b/drivers/acpi/resources/rscalc.c
@@ -78,6 +78,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field)
78 ACPI_FUNCTION_ENTRY(); 78 ACPI_FUNCTION_ENTRY();
79 79
80 for (bits_set = 0; bit_field; bits_set++) { 80 for (bits_set = 0; bit_field; bits_set++) {
81
81 /* Zero the least significant bit that is set */ 82 /* Zero the least significant bit that is set */
82 83
83 bit_field &= (bit_field - 1); 84 bit_field &= (bit_field - 1);
@@ -154,6 +155,7 @@ acpi_rs_stream_option_length(u32 resource_length,
154 * length, minus one byte for the resource_source_index itself. 155 * length, minus one byte for the resource_source_index itself.
155 */ 156 */
156 if (resource_length > minimum_aml_resource_length) { 157 if (resource_length > minimum_aml_resource_length) {
158
157 /* Compute the length of the optional string */ 159 /* Compute the length of the optional string */
158 160
159 string_length = 161 string_length =
@@ -162,7 +164,7 @@ acpi_rs_stream_option_length(u32 resource_length,
162 164
163 /* Round up length to 32 bits for internal structure alignment */ 165 /* Round up length to 32 bits for internal structure alignment */
164 166
165 return (ACPI_ROUND_UP_to_32_bITS(string_length)); 167 return ((u32) ACPI_ROUND_UP_to_32_bITS(string_length));
166} 168}
167 169
168/******************************************************************************* 170/*******************************************************************************
@@ -191,6 +193,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
191 /* Traverse entire list of internal resource descriptors */ 193 /* Traverse entire list of internal resource descriptors */
192 194
193 while (resource) { 195 while (resource) {
196
194 /* Validate the descriptor type */ 197 /* Validate the descriptor type */
195 198
196 if (resource->type > ACPI_RESOURCE_TYPE_MAX) { 199 if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
@@ -214,6 +217,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
214 * is a Large Resource data type. 217 * is a Large Resource data type.
215 */ 218 */
216 if (resource->data.vendor.byte_length > 7) { 219 if (resource->data.vendor.byte_length > 7) {
220
217 /* Base size of a Large resource descriptor */ 221 /* Base size of a Large resource descriptor */
218 222
219 total_size = 223 total_size =
@@ -346,6 +350,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
346 /* Walk the list of AML resource descriptors */ 350 /* Walk the list of AML resource descriptors */
347 351
348 while (aml_buffer < end_aml) { 352 while (aml_buffer < end_aml) {
353
349 /* Validate the Resource Type and Resource Length */ 354 /* Validate the Resource Type and Resource Length */
350 355
351 status = acpi_ut_validate_resource(aml_buffer, &resource_index); 356 status = acpi_ut_validate_resource(aml_buffer, &resource_index);
@@ -390,7 +395,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
390 * Vendor Resource: 395 * Vendor Resource:
391 * Ensure a 32-bit boundary for the structure 396 * Ensure a 32-bit boundary for the structure
392 */ 397 */
393 extra_struct_bytes = 398 extra_struct_bytes = (u32)
394 ACPI_ROUND_UP_to_32_bITS(resource_length) - 399 ACPI_ROUND_UP_to_32_bITS(resource_length) -
395 resource_length; 400 resource_length;
396 break; 401 break;
@@ -407,7 +412,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
407 * Vendor Resource: 412 * Vendor Resource:
408 * Add vendor data and ensure a 32-bit boundary for the structure 413 * Add vendor data and ensure a 32-bit boundary for the structure
409 */ 414 */
410 extra_struct_bytes = 415 extra_struct_bytes = (u32)
411 ACPI_ROUND_UP_to_32_bITS(resource_length) - 416 ACPI_ROUND_UP_to_32_bITS(resource_length) -
412 resource_length; 417 resource_length;
413 break; 418 break;
@@ -431,7 +436,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
431 */ 436 */
432 buffer++; 437 buffer++;
433 438
434 extra_struct_bytes = 439 extra_struct_bytes = (u32)
435 /* 440 /*
436 * Add 4 bytes for each additional interrupt. Note: at 441 * Add 4 bytes for each additional interrupt. Note: at
437 * least one interrupt is required and is included in 442 * least one interrupt is required and is included in
@@ -450,7 +455,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
450 * Add the size of any optional data (resource_source) 455 * Add the size of any optional data (resource_source)
451 * Ensure a 64-bit boundary for the structure 456 * Ensure a 64-bit boundary for the structure
452 */ 457 */
453 extra_struct_bytes = 458 extra_struct_bytes = (u32)
454 ACPI_ROUND_UP_to_64_bITS 459 ACPI_ROUND_UP_to_64_bITS
455 (acpi_rs_stream_option_length 460 (acpi_rs_stream_option_length
456 (resource_length, minimum_aml_resource_length)); 461 (resource_length, minimum_aml_resource_length));
@@ -525,6 +530,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
525 top_object_list = package_object->package.elements; 530 top_object_list = package_object->package.elements;
526 531
527 for (index = 0; index < number_of_elements; index++) { 532 for (index = 0; index < number_of_elements; index++) {
533
528 /* Dereference the sub-package */ 534 /* Dereference the sub-package */
529 535
530 package_element = *top_object_list; 536 package_element = *top_object_list;