Skip to content

Commit 0e89a0f

Browse files
Wer-Wolfrafaeljw
authored andcommitted
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: acpica/acpica@86289439 Signed-off-by: Armin Wolf <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 76a09d9 commit 0e89a0f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/acpi/acpica/exconvrt.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ acpi_ex_convert_to_ascii(u64 integer,
270270
u32 decimal_length;
271271
u32 remainder;
272272
u8 supress_zeros = !leading_zeros;
273+
u8 hex_char;
273274

274275
ACPI_FUNCTION_ENTRY();
275276

@@ -330,8 +331,17 @@ acpi_ex_convert_to_ascii(u64 integer,
330331

331332
/* Get one hex digit, most significant digits first */
332333

333-
string[k] = (u8)
334+
hex_char = (u8)
334335
acpi_ut_hex_to_ascii_char(integer, ACPI_MUL_4(j));
336+
337+
/* Supress leading zeros until the first non-zero character */
338+
339+
if (hex_char == ACPI_ASCII_ZERO && supress_zeros) {
340+
continue;
341+
}
342+
343+
supress_zeros = FALSE;
344+
string[k] = hex_char;
335345
k++;
336346
}
337347
break;

0 commit comments

Comments
 (0)