Skip to content

Commit db0a507

Browse files
Wer-Wolfrafaeljw
authored andcommitted
ACPICA: Update integer-to-hex-string conversions
ACPICA commit f2cb44f6deb6325a6b348b225fc82f565a870899 Add "0x" prefix for explicitly converted integers and suppress leading zeros in such a case. Provides compatibility with other ACPI implementations. Link: acpica/acpica@f2cb44f6 Signed-off-by: Armin Wolf <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 0e89a0f commit db0a507

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/acpi/acpica/exconvrt.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,16 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
417417
base = 10;
418418
break;
419419

420+
case ACPI_EXPLICIT_CONVERT_HEX:
421+
/*
422+
* From to_hex_string.
423+
*
424+
* Supress leading zeros and append "0x"
425+
*/
426+
string_length =
427+
ACPI_MUL_2(acpi_gbl_integer_byte_width) + 2;
428+
leading_zeros = FALSE;
429+
break;
420430
default:
421431

422432
/* Two hex string characters for each integer byte */
@@ -437,6 +447,13 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
437447
}
438448

439449
new_buf = return_desc->buffer.pointer;
450+
if (type == ACPI_EXPLICIT_CONVERT_HEX) {
451+
452+
/* Append "0x" prefix for explicit hex conversion */
453+
454+
*new_buf++ = '0';
455+
*new_buf++ = 'x';
456+
}
440457

441458
/* Convert integer to string */
442459

@@ -449,6 +466,13 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
449466
/* Null terminate at the correct place */
450467

451468
return_desc->string.length = string_length;
469+
if (type == ACPI_EXPLICIT_CONVERT_HEX) {
470+
471+
/* Take "0x" prefix into account */
472+
473+
return_desc->string.length += 2;
474+
}
475+
452476
new_buf[string_length] = 0;
453477
break;
454478

0 commit comments

Comments
 (0)