ACPI: use %pe for better readability of errors while printing
Subsystems (4)
A message that is not in the archive (sent off-list or not yet received): CGME20240213074430epcas5p4c520bf2cce121cf5fa970eed429231a8@epcas5p4.samsung.com
PATCH v3 1/2 ACPI: use %pe for better readability of errors while printing
From: Onkarnath <[email protected]>
As %pe is already introduced, it's better to use it in place of (%ld) for printing errors in logs. It would enhance readability of logs.
---
v1 -> v2: Updated subject line as per file history & corrected spellings in description.
v2 -> v3: Updated Reviewed-by tag.
drivers/acpi/acpi_processor.c | 2 +- drivers/acpi/acpi_watchdog.c | 2 +- drivers/acpi/pci_slot.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/acpi_processor.c +1 -1
@@ -161,7 +161,7 @@ static void cpufreq_add_device(const char *name) pdev =platform_device_register_simple (name,PLATFORM_DEVID_NONE ,NULL ,0 );if (IS_ERR (pdev)) -pr_info ("%s device creation failed: %ld\n" , name,PTR_ERR (pdev)); +pr_info ("%s device creation failed: %pe\n" , name, pdev); }#ifdef CONFIG_X86
drivers/acpi/acpi_watchdog.c +1 -1
@@ -179,7 +179,7 @@ void __init acpi_watchdog_init(void) pdev =platform_device_register_simple ("wdat_wdt" ,PLATFORM_DEVID_NONE , resources, nresources);if (IS_ERR (pdev)) -pr_err ("Device creation failed: %ld\n" ,PTR_ERR (pdev)); +pr_err ("Device creation failed: %pe\n" , pdev);kfree (resources);
drivers/acpi/pci_slot.c +1 -1
@@ -111,7 +111,7 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)snprintf (name,sizeof (name),"%llu" , sun); pci_slot =pci_create_slot (pci_bus, device, name,NULL );if (IS_ERR (pci_slot)) { -pr_err ("pci_create_slot returned %ld\n" ,PTR_ERR (pci_slot)); +pr_err ("pci_create_slot returned %pe\n" , pci_slot);kfree (slot);return AE_OK ; }
Signature · 1 line
2.25.1
PATCH v3 2/2 cpufreq/schedutil: print errors with %pe for better readability of logs
From: Onkarnath <[email protected]>
Instead of printing errros as a number(%ld), it's better to print in string format for better readability of logs.
---
v1 -> v2: Updated subject as per file history.
v2 -> v3: No change in this patch, change done in PATCH v3 1/2.
kernel/sched/cpufreq_schedutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/cpufreq_schedutil.c +1 -1
@@ -671,7 +671,7 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy)"sugov:%d" , cpumask_first(policy->related_cpus));if (IS_ERR (thread)) { -pr_err ("failed to create sugov thread: %ld\n" ,PTR_ERR (thread)); +pr_err ("failed to create sugov thread: %pe\n" , thread);return PTR_ERR (thread); }
Signature · 1 line
2.25.1
Quoted 4 lines · Onkarnarth
From: Onkarnath <[email protected]>
As %pe is already introduced, it's better to use it in place of (%ld) for printing errors in logs. It would enhance readability of logs.
Here are some more candidates that I see regularly:
Something like:
git grep "\(_info(\|_warn(\).*%d"
finds a ton of them (plus a lot of unrelated hits, of course). If you were to do this for drivers/pci/, I would want them all for the whole directory in a single patch, and I would take the opportunity to make minor changes so the style is more consistent, e.g.,
"... failed (%pe)" or something.
Bjorn
Rafael J. Wysocki
maintainerQuoted 7 lines · Onkarnarth
From: Onkarnath <[email protected]>
As %pe is already introduced, it's better to use it in place of (%ld) for printing errors in logs. It would enhance readability of logs.
Signed-off-by Maninder Singh <[email protected]>
What exactly is the role of this S-o-b? Has the person helped you to develop the patch or something else?
Quoted 52 lines
Signed-off-by Onkarnath <[email protected]>Reviewed-by Stanislaw Gruszka <[email protected]>---
v1 -> v2: Updated subject line as per file history & corrected spellings in description.
v2 -> v3: Updated Reviewed-by tag.drivers/acpi/acpi_processor.c | 2 +- drivers/acpi/acpi_watchdog.c | 2 +- drivers/acpi/pci_slot.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)drivers/acpi/acpi_processor.c +1
-1@@ -161,7 +161,7 @@ static void cpufreq_add_device(const char *name) pdev =platform_device_register_simple (name,PLATFORM_DEVID_NONE ,NULL ,0 );if (IS_ERR (pdev)) -pr_info ("%s device creation failed: %ld\n" , name,PTR_ERR (pdev)); +pr_info ("%s device creation failed: %pe\n" , name, pdev); }#ifdef CONFIG_X86 drivers/acpi/acpi_watchdog.c +1
-1@@ -179,7 +179,7 @@ void __init acpi_watchdog_init(void) pdev =platform_device_register_simple ("wdat_wdt" ,PLATFORM_DEVID_NONE , resources, nresources);if (IS_ERR (pdev)) -pr_err ("Device creation failed: %ld\n" ,PTR_ERR (pdev)); +pr_err ("Device creation failed: %pe\n" , pdev);kfree (resources);drivers/acpi/pci_slot.c +1
-2@@ -111,7 +111,7 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)snprintf (name,sizeof (name),"%llu" , sun); pci_slot =pci_create_slot (pci_bus, device, name,NULL );if (IS_ERR (pci_slot)) { -pr_err ("pci_create_slot returned %ld\n" ,PTR_ERR (pci_slot)); +pr_err ("pci_create_slot returned %pe\n" , pci_slot);kfree (slot);return AE_OK ; } --
Quoted 12 lines · Onkarnarth
Quoted 7 lines
From: Onkarnath <[email protected]>
As %pe is already introduced, it's better to use it in place of (%ld) for printing errors in logs. It would enhance readability of logs.
Signed-off-by Maninder Singh <[email protected]>What exactly is the role of this S-o-b? Has the person helped you to develop the patch or something else?
Yes It was meant for Co-developed tag, Because We are working collectively for making errors more readable for our product kernel.(5.4) And some part of this patch was made by him.
Then we checked that it is also suggested by open source to have %pe for printing errors:
https://lore.kernel.org/all/[email protected]/
So I prepared same changes for open source kernel, and because of smaller patch I kept it as normal signed-off tag only. If it is needed I can resend with Co-developed tag.
Thanks,
Onkarnath
Rafael J. Wysocki
maintainerQuoted 14 lines · Onkarnath
Quoted 13 lines · Onkarnarth
Quoted 7 lines
From: Onkarnath <[email protected]>
As %pe is already introduced, it's better to use it in place of (%ld) for printing errors in logs. It would enhance readability of logs.
Signed-off-by Maninder Singh <[email protected]>What exactly is the role of this S-o-b? Has the person helped you to develop the patch or something else?
Quoted 8 lines
Yes It was meant for Co-developed tag, Because We are working collectively for making errors more readable for our product kernel.(5.4) And some part of this patch was made by him.
Then we checked that it is also suggested by open source to have %pe for printing errors:
https://lore.kernel.org/all/[email protected]/So I prepared same changes for open source kernel, and because of smaller patch I kept it as normal signed-off tag only. If it is needed I can resend with Co-developed tag.
No need, I can add it for you. Thanks for the explanation!
Quoted 50 lines · Onkarnarth
From: Onkarnath <[email protected]>
As %pe is already introduced, it's better to use it in place of (%ld) for printing errors in logs. It would enhance readability of logs.
Signed-off-by Maninder Singh <[email protected]>Signed-off-by Onkarnath <[email protected]>Reviewed-by Stanislaw Gruszka <[email protected]>---
v1 -> v2: Updated subject line as per file history & corrected spellings in description.
v2 -> v3: Updated Reviewed-by tag.drivers/acpi/acpi_processor.c | 2 +- drivers/acpi/acpi_watchdog.c | 2 +- drivers/acpi/pci_slot.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)drivers/acpi/acpi_processor.c +1
-1@@ -161,7 +161,7 @@ static void cpufreq_add_device(const char *name) pdev =platform_device_register_simple (name,PLATFORM_DEVID_NONE ,NULL ,0 );if (IS_ERR (pdev)) -pr_info ("%s device creation failed: %ld\n" , name,PTR_ERR (pdev)); +pr_info ("%s device creation failed: %pe\n" , name, pdev); }#ifdef CONFIG_X86 drivers/acpi/acpi_watchdog.c +1
-1@@ -179,7 +179,7 @@ void __init acpi_watchdog_init(void) pdev =platform_device_register_simple ("wdat_wdt" ,PLATFORM_DEVID_NONE , resources, nresources);if (IS_ERR (pdev)) -pr_err ("Device creation failed: %ld\n" ,PTR_ERR (pdev)); +pr_err ("Device creation failed: %pe\n" , pdev);kfree (resources);drivers/acpi/pci_slot.c +0
-0
drivers/acpi/pci_slot.c register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
Quoted 9 lines
drivers/acpi/pci_slot.c +1
-2@@ -111,7 +111,7 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)snprintf (name,sizeof (name),"%llu" , sun); pci_slot =pci_create_slot (pci_bus, device, name,NULL );if (IS_ERR (pci_slot)) { -pr_err ("pci_create_slot returned %ld\n" ,PTR_ERR (pci_slot)); +pr_err ("pci_create_slot returned %pe\n" , pci_slot);kfree (slot);return AE_OK ; } --
Applied as 6.9 material, thanks!