Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: https://github.com/acpica/acpica/commit/f2cb44f6
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Armin Wolf and committed by
Rafael J. Wysocki
db0a507c 0e89a0fc

+24
+24
drivers/acpi/acpica/exconvrt.c
··· 417 417 base = 10; 418 418 break; 419 419 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; 420 430 default: 421 431 422 432 /* Two hex string characters for each integer byte */ ··· 447 437 } 448 438 449 439 new_buf = return_desc->buffer.pointer; 440 + if (type == ACPI_EXPLICIT_CONVERT_HEX) { 441 + 442 + /* Append "0x" prefix for explicit hex conversion */ 443 + 444 + *new_buf++ = '0'; 445 + *new_buf++ = 'x'; 446 + } 450 447 451 448 /* Convert integer to string */ 452 449 ··· 466 449 /* Null terminate at the correct place */ 467 450 468 451 return_desc->string.length = string_length; 452 + if (type == ACPI_EXPLICIT_CONVERT_HEX) { 453 + 454 + /* Take "0x" prefix into account */ 455 + 456 + return_desc->string.length += 2; 457 + } 458 + 469 459 new_buf[string_length] = 0; 470 460 break; 471 461