1

ACPICA: Add support for supressing leading zeros in hex strings

ACPICA commit 86289439d9f8b9eda28c249da66ae230d6439491

Currently the leading_zeros argument has no effect when
converting hex integers. Fix that.

Link: https://github.com/acpica/acpica/commit/86289439
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Armin Wolf 2023-10-28 00:04:16 +02:00 committed by Rafael J. Wysocki
parent 76a09d941c
commit 0e89a0fc55

View File

@ -270,6 +270,7 @@ acpi_ex_convert_to_ascii(u64 integer,
u32 decimal_length;
u32 remainder;
u8 supress_zeros = !leading_zeros;
u8 hex_char;
ACPI_FUNCTION_ENTRY();
@ -330,8 +331,17 @@ acpi_ex_convert_to_ascii(u64 integer,
/* Get one hex digit, most significant digits first */
string[k] = (u8)
hex_char = (u8)
acpi_ut_hex_to_ascii_char(integer, ACPI_MUL_4(j));
/* Supress leading zeros until the first non-zero character */
if (hex_char == ACPI_ASCII_ZERO && supress_zeros) {
continue;
}
supress_zeros = FALSE;
string[k] = hex_char;
k++;
}
break;