ACPI: glue: Reduce debug noise from acpi_device_notify()
Rafael J. Wysocki
maintainerPATCH 1/1 ACPI: glue: Reduce debug noise from acpi_device_notify()
From: "Rafael J. Wysocki" <[email protected]>
When debug is enabled in the ACPI glue code that handles binding devices to ACPI companions, acpi_device_notify() produces a lot of message noise related to devices that have no ACPI companions.
Reduce that noise by checking the most obvious cases, ACPI device objects and devices without a bus type, directly and returning from acpi_device_notify() in these cases without printing any debug messages.
Also make the debug messages that get printed more informative and change the format prefix to "ACPI/glue", so it is easier to filter these messages.
--- drivers/acpi/glue.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
drivers/acpi/glue.c +20 -14
@@ -6,7 +6,7 @@* Copyright (c) 2005 Intel Corp. */ -#define pr_fmt (fmt) "ACPI: " fmt +#define pr_fmt (fmt) "ACPI/glue: " fmt#include <linux/acpi_iort.h> #include <linux/export.h>
@@ -354,22 +354,33 @@ void acpi_device_notify(struct device *dstruct acpi_device *adev;int ret; +/* ACPI devices have no ACPI companions. */ +if (dev->bus == &acpi_bus_type) +return ; + ret =acpi_bind_one (dev,NULL );if (ret) { -struct acpi_bus_type *type =acpi_get_bus_type (dev); - -if (!type) - goto err; +struct acpi_bus_type *type; +/* Skip devices without bus types. */ +if (!dev->bus) +return ; + + type =acpi_get_bus_type (dev); +if (!type) { +dev_dbg (dev,"No matching ACPI bus type description\n" ); +return ; + } adev = type->find_companion (dev);if (!adev) {dev_dbg (dev,"ACPI companion not found\n" ); - goto err; +return ; } ret =acpi_bind_one (dev, adev); -if (ret) - goto err; - +if (ret) { +dev_dbg (dev,"Binding to ACPI companion failed\n" ); +return ; + }if (type->setup) { type->setup (dev); goto done;
@@ -391,11 +402,6 @@ void acpi_device_notify(struct device *d done:acpi_handle_debug (ACPI_HANDLE (dev),"Bound to device %s\n" ,dev_name (dev)); - -return ; - -err: -dev_dbg (dev,"No ACPI support\n" ); }void acpi_device_notify_remove (struct device *dev)
Quoted 6 lines · Rafael J. Wysocki
From: "Rafael J. Wysocki" <[email protected]>
When debug is enabled in the ACPI glue code that handles binding devices to ACPI companions,
acpi_device_notify()produces a lot of message noise related to devices that have no ACPI companions.
Quoted 8 lines
Reduce that noise by checking the most obvious cases, ACPI device objects and devices without a bus type, directly and returning from
acpi_device_notify()in these cases without printing any debug messages.Also make the debug messages that get printed more informative and change the format prefix to "ACPI/glue", so it is easier to filter these messages.
I would argue that the consistent formatting will be "ACPI: glue: "
$ git grep -n 'pr_fmt.*ACPI: [^"]' -- drivers/acpi/ | wc -l 24
The / is used only in two cases: acpi/hmat and acpi/mrrm.
Signature · 2 lines
With Best Regards, Andy Shevchenko