aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exconvrt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer/exconvrt.c')
-rw-r--r--drivers/acpi/executer/exconvrt.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c
index df7ba1219bf6..97856c48bd74 100644
--- a/drivers/acpi/executer/exconvrt.c
+++ b/drivers/acpi/executer/exconvrt.c
@@ -50,6 +50,15 @@
50#define _COMPONENT ACPI_EXECUTER 50#define _COMPONENT ACPI_EXECUTER
51 ACPI_MODULE_NAME ("exconvrt") 51 ACPI_MODULE_NAME ("exconvrt")
52 52
53/* Local prototypes */
54
55static u32
56acpi_ex_convert_to_ascii (
57 acpi_integer integer,
58 u16 base,
59 u8 *string,
60 u8 max_length);
61
53 62
54/******************************************************************************* 63/*******************************************************************************
55 * 64 *
@@ -115,9 +124,8 @@ acpi_ex_convert_to_integer (
115 */ 124 */
116 result = 0; 125 result = 0;
117 126
118 /* 127 /* String conversion is different than Buffer conversion */
119 * String conversion is different than Buffer conversion 128
120 */
121 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { 129 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
122 case ACPI_TYPE_STRING: 130 case ACPI_TYPE_STRING:
123 131
@@ -168,9 +176,8 @@ acpi_ex_convert_to_integer (
168 break; 176 break;
169 } 177 }
170 178
171 /* 179 /* Create a new integer */
172 * Create a new integer 180
173 */
174 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); 181 return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
175 if (!return_desc) { 182 if (!return_desc) {
176 return_ACPI_STATUS (AE_NO_MEMORY); 183 return_ACPI_STATUS (AE_NO_MEMORY);
@@ -251,7 +258,8 @@ acpi_ex_convert_to_buffer (
251 * ASL/AML code that depends on the null being transferred to the new 258 * ASL/AML code that depends on the null being transferred to the new
252 * buffer. 259 * buffer.
253 */ 260 */
254 return_desc = acpi_ut_create_buffer_object ((acpi_size) obj_desc->string.length + 1); 261 return_desc = acpi_ut_create_buffer_object (
262 (acpi_size) obj_desc->string.length + 1);
255 if (!return_desc) { 263 if (!return_desc) {
256 return_ACPI_STATUS (AE_NO_MEMORY); 264 return_ACPI_STATUS (AE_NO_MEMORY);
257 } 265 }
@@ -291,7 +299,7 @@ acpi_ex_convert_to_buffer (
291 * 299 *
292 ******************************************************************************/ 300 ******************************************************************************/
293 301
294u32 302static u32
295acpi_ex_convert_to_ascii ( 303acpi_ex_convert_to_ascii (
296 acpi_integer integer, 304 acpi_integer integer,
297 u16 base, 305 u16 base,
@@ -357,8 +365,9 @@ acpi_ex_convert_to_ascii (
357 365
358 case 16: 366 case 16:
359 367
360 hex_length = ACPI_MUL_2 (data_width); /* 2 ascii hex chars per data byte */ 368 /* hex_length: 2 ascii hex chars per data byte */
361 369
370 hex_length = ACPI_MUL_2 (data_width);
362 for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) { 371 for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) {
363 /* Get one hex digit, most significant digits first */ 372 /* Get one hex digit, most significant digits first */
364 373
@@ -475,7 +484,7 @@ acpi_ex_convert_to_string (
475 /* Setup string length, base, and separator */ 484 /* Setup string length, base, and separator */
476 485
477 switch (type) { 486 switch (type) {
478 case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string operator */ 487 case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */
479 /* 488 /*
480 * From ACPI: "If Data is a buffer, it is converted to a string of 489 * From ACPI: "If Data is a buffer, it is converted to a string of
481 * decimal values separated by commas." 490 * decimal values separated by commas."
@@ -509,7 +518,7 @@ acpi_ex_convert_to_string (
509 string_length = (obj_desc->buffer.length * 3); 518 string_length = (obj_desc->buffer.length * 3);
510 break; 519 break;
511 520
512 case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string operator */ 521 case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */
513 /* 522 /*
514 * From ACPI: "If Data is a buffer, it is converted to a string of 523 * From ACPI: "If Data is a buffer, it is converted to a string of
515 * hexadecimal values separated by commas." 524 * hexadecimal values separated by commas."
@@ -530,9 +539,8 @@ acpi_ex_convert_to_string (
530 return_ACPI_STATUS (AE_AML_STRING_LIMIT); 539 return_ACPI_STATUS (AE_AML_STRING_LIMIT);
531 } 540 }
532 541
533 /* 542 /* Create a new string object and string buffer */
534 * Create a new string object and string buffer 543
535 */
536 return_desc = acpi_ut_create_string_object ((acpi_size) string_length); 544 return_desc = acpi_ut_create_string_object ((acpi_size) string_length);
537 if (!return_desc) { 545 if (!return_desc) {
538 return_ACPI_STATUS (AE_NO_MEMORY); 546 return_ACPI_STATUS (AE_NO_MEMORY);
@@ -551,8 +559,10 @@ acpi_ex_convert_to_string (
551 *new_buf++ = separator; /* each separated by a comma or space */ 559 *new_buf++ = separator; /* each separated by a comma or space */
552 } 560 }
553 561
554 /* Null terminate the string (overwrites final comma/space from above) */ 562 /*
555 563 * Null terminate the string
564 * (overwrites final comma/space from above)
565 */
556 new_buf--; 566 new_buf--;
557 *new_buf = 0; 567 *new_buf = 0;
558 break; 568 break;
@@ -645,7 +655,6 @@ acpi_ex_convert_to_target_type (
645 655
646 656
647 case ACPI_TYPE_STRING: 657 case ACPI_TYPE_STRING:
648
649 /* 658 /*
650 * The operand must be a String. We can convert an 659 * The operand must be a String. We can convert an
651 * Integer or Buffer if necessary 660 * Integer or Buffer if necessary
@@ -656,7 +665,6 @@ acpi_ex_convert_to_target_type (
656 665
657 666
658 case ACPI_TYPE_BUFFER: 667 case ACPI_TYPE_BUFFER:
659
660 /* 668 /*
661 * The operand must be a Buffer. We can convert an 669 * The operand must be a Buffer. We can convert an
662 * Integer or String if necessary 670 * Integer or String if necessary