diff options
author | Armin Wolf <W_Armin@gmx.de> | 2023-10-28 00:04:16 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2024-08-29 19:04:22 +0200 |
commit | 0e89a0fc55f025ab0f89a75dd3e5cdaf869d5ce9 (patch) | |
tree | aabdfb09a5fa3297a5266d0898085f8d87c0e868 /drivers/acpi/acpica | |
parent | 76a09d941c5ce2b95c911edcc2ae1353ec9a4c83 (diff) |
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>
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r-- | drivers/acpi/acpica/exconvrt.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c index 4e8ab3c26565..9647325d290d 100644 --- a/drivers/acpi/acpica/exconvrt.c +++ b/drivers/acpi/acpica/exconvrt.c @@ -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; |