From 46d57a7a8e331ad402783a77d246c4196ba21863 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Mon, 3 Jul 2023 17:58:38 +0300 Subject: docs: printk-formats: Fix hex printing of signed values The commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]") obviously missed the point of sign promotion for the signed values lesser than int. In such case %x prints not the same as %h[h]x. Restore back those specifiers for the signed hex cases. Fixes: cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]") Signed-off-by: Andy Shevchenko Reviewed-by: Petr Mladek Signed-off-by: Petr Mladek Link: https://lore.kernel.org/r/20230703145839.14248-1-andriy.shevchenko@linux.intel.com --- Documentation/core-api/printk-formats.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Documentation/core-api/printk-formats.rst') diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst index dbe1aacc79d0..956c87b3ba8b 100644 --- a/Documentation/core-api/printk-formats.rst +++ b/Documentation/core-api/printk-formats.rst @@ -15,9 +15,9 @@ Integer types If variable is of Type, use printk format specifier: ------------------------------------------------------------ - char %d or %x + char %d or %hhx unsigned char %u or %x - short int %d or %x + short int %d or %hx unsigned short int %u or %x int %d or %x unsigned int %u or %x @@ -27,9 +27,9 @@ Integer types unsigned long long %llu or %llx size_t %zu or %zx ssize_t %zd or %zx - s8 %d or %x + s8 %d or %hhx u8 %u or %x - s16 %d or %x + s16 %d or %hx u16 %u or %x s32 %d or %x u32 %u or %x -- cgit From 243e212ff82f6aaabc2793049571a199067738d3 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Mon, 3 Jul 2023 17:58:39 +0300 Subject: docs: printk-formats: Treat char as always unsigned The Linux kernel switched to have char be equivalent to usigned char. Reflect this in the printk specifiers. Fixes: 3bc753c06dd0 ("kbuild: treat char as always unsigned") Signed-off-by: Andy Shevchenko Reviewed-by: Petr Mladek Signed-off-by: Petr Mladek Link: https://lore.kernel.org/r/20230703145839.14248-2-andriy.shevchenko@linux.intel.com --- Documentation/core-api/printk-formats.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Documentation/core-api/printk-formats.rst') diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst index 956c87b3ba8b..0eed8a2dcae9 100644 --- a/Documentation/core-api/printk-formats.rst +++ b/Documentation/core-api/printk-formats.rst @@ -15,8 +15,9 @@ Integer types If variable is of Type, use printk format specifier: ------------------------------------------------------------ - char %d or %hhx + signed char %d or %hhx unsigned char %u or %x + char %u or %x short int %d or %hx unsigned short int %u or %x int %d or %x -- cgit