ACPICA: AML Parser: Remove spurious precision from format used to dump parse trees
Subsystems (2)
PATCH 1/1 ACPICA: AML Parser: Remove spurious precision from format used to dump parse trees
From: David Laight <[email protected]>
The debug code in acpi_ps_delete_parse_tree() uses ("%*.s", level * 4, " ") to indent traces.
POSIX requires the empty precision be treated as zero, but the kernel treats is as 'no precision specified'.
Change to ("%*s", level * 4, "") since there is additional whitespace and no reason to indent by one space when level is zero.
--- drivers/acpi/acpica/pswalk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/acpi/acpica/pswalk.c +1 -2
@@ -49,8 +49,7 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)/* This debug option will print the entire parse tree */ - acpi_os_printf(" %*.s%s %p", (level * 4), - " ", + acpi_os_printf(" %*s%s %p", (level * 4), "", acpi_ps_get_opcode_name(op-> common. aml_opcode),
Signature · 1 line
2.39.5
Quoted 6 lines · On Thu, Mar 26, 2026 at 08:18:30PM +0000, [email protected] wrote:
The debug code in
acpi_ps_delete_parse_tree()uses ("%*.s", level * 4, " ") to indent traces.
POSIX requires the empty precision be treated as zero, but the kernel treats is as 'no precision specified'.
Change to ("%*s", level * 4, "") since there is additional whitespace and no reason to indent by one space when level is zero.
This is cross-platform code. Does the same applies to MS VC compiler, for example?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 9 lines · On Fri, 27 Mar 2026 11:28:26 +0200 Andy Shevchenko…
Quoted 6 lines · On Thu, Mar 26, 2026 at 08:18:30PM +0000, [email protected] wrote:
The debug code in
acpi_ps_delete_parse_tree()uses ("%*.s", level * 4, " ") to indent traces.
POSIX requires the empty precision be treated as zero, but the kernel treats is as 'no precision specified'.
Change to ("%*s", level * 4, "") since there is additional whitespace and no reason to indent by one space when level is zero.
Quoted 3 lines
This is cross-platform code. Does the same applies to MS VC compiler, for example?
Everything except the linux kernel will treat "%*.s" as "%*.0s".
Regardless of anything else specifying a 'precision' when printing a constant string is entirely pointless - it limits the number of characters copied from the string.
Basically "%*.s" is always a typo, either for "%.*s" or "%*s".
David
Rafael J. Wysocki
maintainerQuoted 17 lines · David Laight
Quoted 9 lines · On Fri, 27 Mar 2026 11:28:26 +0200 Andy Shevchenko…
Quoted 6 lines · On Thu, Mar 26, 2026 at 08:18:30PM +0000, [email protected] wrote:
The debug code in
acpi_ps_delete_parse_tree()uses ("%*.s", level * 4, " ") to indent traces.
POSIX requires the empty precision be treated as zero, but the kernel treats is as 'no precision specified'.
Change to ("%*s", level * 4, "") since there is additional whitespace and no reason to indent by one space when level is zero.Quoted 3 lines
This is cross-platform code. Does the same applies to MS VC compiler, for example?
Quoted 7 lines
Everything except the linux kernel will treat "%*.s" as "%*.0s".
Regardless of anything else specifying a 'precision' when printing a constant string is entirely pointless - it limits the number of characters copied from the string.
Basically "%*.s" is always a typo, either for "%.*s" or "%*s".
So this change should be made in upstream ACPICA in the first place as per Documentation/driver-api/acpi/linuxized-acpica.rst.
Would you please send a PR to the upstream ACPICA project on GH? Alternatively, someone else may make that change upstream with a Suggested-by tag pointing to you.
Quoted 25 lines · On Fri, 27 Mar 2026 10:58:14 +0100 "Rafael J. Wysocki" <[email protected]>…
Quoted 23 lines · David Laight
Quoted 9 lines · On Fri, 27 Mar 2026 11:28:26 +0200 Andy Shevchenko…
Quoted 6 lines · On Thu, Mar 26, 2026 at 08:18:30PM +0000, [email protected] wrote:
The debug code in
acpi_ps_delete_parse_tree()uses ("%*.s", level * 4, " ") to indent traces.
POSIX requires the empty precision be treated as zero, but the kernel treats is as 'no precision specified'.
Change to ("%*s", level * 4, "") since there is additional whitespace and no reason to indent by one space when level is zero.Quoted 3 lines
This is cross-platform code. Does the same applies to MS VC compiler, for example?
Everything except the linux kernel will treat "%*.s" as "%*.0s".
Regardless of anything else specifying a 'precision' when printing a constant string is entirely pointless - it limits the number of characters copied from the string.
Quoted 6 lines
Quoted 1 line
Basically "%*.s" is always a typo, either for "%.*s" or "%*s".
So this change should be made in upstream ACPICA in the first place as per
Documentation/driver-api/acpi/linuxized-acpica.rst.Would you please send a PR to the upstream ACPICA project on GH?
I'd have to go through a lot of hoops to do that.
I've never used GH.
David
Quoted 2 lines
Alternatively, someone else may make that change upstream with a Suggested-by tag pointing to you.
Rafael J. Wysocki
maintainerQuoted 31 lines · David Laight
Quoted 27 lines · On Fri, 27 Mar 2026 10:58:14 +0100 "Rafael J. Wysocki" <[email protected]>…
Quoted 24 lines · David Laight
Quoted 9 lines · On Fri, 27 Mar 2026 11:28:26 +0200 Andy Shevchenko…
Quoted 6 lines · On Thu, Mar 26, 2026 at 08:18:30PM +0000, [email protected] wrote:
The debug code in
acpi_ps_delete_parse_tree()uses ("%*.s", level * 4, " ") to indent traces.
POSIX requires the empty precision be treated as zero, but the kernel treats is as 'no precision specified'.
Change to ("%*s", level * 4, "") since there is additional whitespace and no reason to indent by one space when level is zero.Quoted 3 lines
This is cross-platform code. Does the same applies to MS VC compiler, for example?
Everything except the linux kernel will treat "%*.s" as "%*.0s".
Regardless of anything else specifying a 'precision' when printing a constant string is entirely pointless - it limits the number of characters copied from the string.
Basically "%*.s" is always a typo, either for "%.*s" or "%*s".
Quoted 7 lines
Quoted 4 lines
So this change should be made in upstream ACPICA in the first place as per
Documentation/driver-api/acpi/linuxized-acpica.rst.Would you please send a PR to the upstream ACPICA project on GH?
I'd have to go through a lot of hoops to do that.
I've never used GH.
OK, we'll go for the second option then.
Quoted 2 lines
Quoted 2 lines
Alternatively, someone else may make that change upstream with a Suggested-by tag pointing to you.
Quoted 12 lines · On Thu 2026-03-26 20:18:30, [email protected] wrote:
From: David Laight <[email protected]>
The debug code in
acpi_ps_delete_parse_tree()uses ("%*.s", level * 4, " ") to indent traces.
POSIX requires the empty precision be treated as zero, but the kernel treats is as 'no precision specified'.
Change to ("%*s", level * 4, "") since there is additional whitespace and no reason to indent by one space when level is zero.
drivers/acpi/acpica/pswalk.c void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) · line 55
Quoted 9 lines
drivers/acpi/acpica/pswalk.c +1
-2@@ -49,8 +49,7 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)/* This debug option will print the entire parse tree */ - acpi_os_printf(" %*.s%s %p", (level * 4), - " ", + acpi_os_printf(" %*s%s %p", (level * 4), "", acpi_ps_get_opcode_name(op-> common. aml_opcode),
The change has no visible effect. The precision defines how many characters are copied from the given string. It does not matter here because the given string is empty "". The number of added spaces ' ' is defined by the field width parameter (level * 4).
Anyway, the change makes sense:
Best Regards,
Petr