Linux ACPI
 help / color / mirror / Atom feed
* [PATCH v4 1/2] ACPI: glue: Reduce debug noise from acpi_device_notify()
@ 2026-09-06 15:50 Rafael J. Wysocki
  2026-09-06 15:51 ` Rafael J. Wysocki
  2026-09-06 15:54 ` [PATCH v4 2/2] ACPI: glue: Rework the success message in acpi_device_notify() Rafael J. Wysocki
  0 siblings, 2 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2026-09-06 15:50 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Andy Shevchenko

This is an update of

https://lore.kernel.org/linux-acpi/6048536.DvuYhMxLoT@rafael.j.wysocki/

that makes fewer changes in the first patch and add a follow-up one.

The second patch takes care of the message printed by acpi_device_notify()
in the success case.

Please see the patch changelogs for more details.

Thanks!




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v4 1/2] ACPI: glue: Reduce debug noise from acpi_device_notify()
  2026-09-06 15:50 [PATCH v4 1/2] ACPI: glue: Reduce debug noise from acpi_device_notify() Rafael J. Wysocki
@ 2026-09-06 15:51 ` Rafael J. Wysocki
  2026-09-08 10:16   ` Andy Shevchenko
  2026-09-06 15:54 ` [PATCH v4 2/2] ACPI: glue: Rework the success message in acpi_device_notify() Rafael J. Wysocki
  1 sibling, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2026-09-06 15:51 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Andy Shevchenko

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

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 case, ACPI device
objects, directly and returning from acpi_device_notify() in that
case without printing any debug messages.  Also avoid printing a
debug message when there is no matching ACPI bus type definition for
the given device, which is the case for the vast majority of devices.

Additionally, make the debug messages that get printed more informative.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

v3 -> v4:
   * Do not update the "success" message (that will be taken care of
     by a separate patch)

v2 -> v3:
   * Do not change pr_fmt() definition (Sashiko)
   * adjust the "success" debug message for devices whose ACPI companions
     have no ACPI handles
   * Update changelog

v1 -> v2:
   * Do not return early from acpi_device_notify() for devices
     without a bus type (Sashiko)
   * Do not print messages for devices without matching ACPI bus
     type definition (the vast majority)
   * Update changelog

---
 drivers/acpi/glue.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -354,22 +354,27 @@ void acpi_device_notify(struct device *d
 	struct 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;
+			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 +396,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)




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v4 2/2] ACPI: glue: Rework the success message in acpi_device_notify()
  2026-09-06 15:50 [PATCH v4 1/2] ACPI: glue: Reduce debug noise from acpi_device_notify() Rafael J. Wysocki
  2026-09-06 15:51 ` Rafael J. Wysocki
@ 2026-09-06 15:54 ` Rafael J. Wysocki
  2026-09-08 10:16   ` Andy Shevchenko
  1 sibling, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2026-09-06 15:54 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Andy Shevchenko

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

Using an ACPI handle in the acpi_device_notify() success message is
somewhat misleading because the "physical" device is not bound to an
ACPI namespace object in that function, but to an ACPI device object
attached to it.  Moreover, the message is outright confusing for the
"physical" devices bound to ACPI devices without ACPI namespace
objects (for example, fixed event buttons).

Address this by turning that message into a dev_dbg() one printed for
the "physical" device and mentioning the name of the ACPI companion.

Fixes: ab06eb920401 ("ACPI: scan: Register platform devices for fixed event buttons")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/glue.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -394,8 +394,7 @@ void acpi_device_notify(struct device *d
 		adev->handler->bind(dev);
 
 done:
-	acpi_handle_debug(ACPI_HANDLE(dev), "Bound to device %s\n",
-			  dev_name(dev));
+	dev_dbg(dev, "Bound to ACPI device %s\n", acpi_dev_name(adev));
 }
 
 void acpi_device_notify_remove(struct device *dev)




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 1/2] ACPI: glue: Reduce debug noise from acpi_device_notify()
  2026-09-06 15:51 ` Rafael J. Wysocki
@ 2026-09-08 10:16   ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2026-09-08 10:16 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux ACPI, LKML

On Sun, Sep 06, 2026 at 05:51:23PM +0200, Rafael J. Wysocki wrote:

> 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.

Indeed, seems better with this patch.

> Reduce that noise by checking the most obvious case, ACPI device
> objects, directly and returning from acpi_device_notify() in that
> case without printing any debug messages.  Also avoid printing a
> debug message when there is no matching ACPI bus type definition for
> the given device, which is the case for the vast majority of devices.
> 
> Additionally, make the debug messages that get printed more informative.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 2/2] ACPI: glue: Rework the success message in acpi_device_notify()
  2026-09-06 15:54 ` [PATCH v4 2/2] ACPI: glue: Rework the success message in acpi_device_notify() Rafael J. Wysocki
@ 2026-09-08 10:16   ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2026-09-08 10:16 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux ACPI, LKML

On Sun, Sep 06, 2026 at 05:54:10PM +0200, Rafael J. Wysocki wrote:

> Using an ACPI handle in the acpi_device_notify() success message is
> somewhat misleading because the "physical" device is not bound to an
> ACPI namespace object in that function, but to an ACPI device object
> attached to it.  Moreover, the message is outright confusing for the
> "physical" devices bound to ACPI devices without ACPI namespace
> objects (for example, fixed event buttons).
> 
> Address this by turning that message into a dev_dbg() one printed for
> the "physical" device and mentioning the name of the ACPI companion.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-08 10:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-06 15:50 [PATCH v4 1/2] ACPI: glue: Reduce debug noise from acpi_device_notify() Rafael J. Wysocki
2026-09-06 15:51 ` Rafael J. Wysocki
2026-09-08 10:16   ` Andy Shevchenko
2026-09-06 15:54 ` [PATCH v4 2/2] ACPI: glue: Rework the success message in acpi_device_notify() Rafael J. Wysocki
2026-09-08 10:16   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox