mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1] ACPI: bus: Clean up devm_acpi_install_notify_handler()
Date: Wed, 03 Jun 2026 20:26:24 +0200	[thread overview]
Message-ID: <2841496.mvXUDI8C0e@rafael.j.wysocki> (raw)

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

Add a pointer to the struct acpi_device used for installing the ACPI
notify handler to struct acpi_notify_handler_devres so it need not
be retrieved from the owner device via ACPI_COMPANION() in
devm_acpi_notify_handler_release().

While at it, drop the function name from one of the messages printed
by devm_acpi_install_notify_handler() for consistency and fix up white
space in its kerneldoc comment.

No intentional functional impact.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

Applies on top of linux-next.

---
 drivers/acpi/bus.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -680,6 +680,7 @@ void acpi_dev_remove_notify_handler(stru
 EXPORT_SYMBOL_GPL(acpi_dev_remove_notify_handler);
 
 struct acpi_notify_handler_devres {
+	struct acpi_device *adev;
 	acpi_notify_handler handler;
 	u32 handler_type;
 };
@@ -688,13 +689,12 @@ static void devm_acpi_notify_handler_rel
 {
 	struct acpi_notify_handler_devres *dr = res;
 
-	acpi_dev_remove_notify_handler(ACPI_COMPANION(dev), dr->handler_type,
-				       dr->handler);
+	acpi_dev_remove_notify_handler(dr->adev, dr->handler_type, dr->handler);
 }
 
 /**
  * devm_acpi_install_notify_handler - Install an ACPI notify handler for a
- * 				      managed device
+ *				      managed device
  * @dev: Device to install a notify handler for
  * @handler_type: Type of the notify handler
  * @handler: Handler function to install
@@ -725,7 +725,7 @@ int devm_acpi_install_notify_handler(str
 
 	adev = ACPI_COMPANION(dev);
 	if (!adev)
-		return dev_err_probe(dev, -ENODEV, "No ACPI companion in %s()\n", __func__);
+		return dev_err_probe(dev, -ENODEV, "No ACPI companion\n");
 
 	dr = devres_alloc(devm_acpi_notify_handler_release, sizeof(*dr), GFP_KERNEL);
 	if (!dr)
@@ -737,6 +737,7 @@ int devm_acpi_install_notify_handler(str
 		return dev_err_probe(dev, ret, "Failed to install an ACPI notify handler\n");
 	}
 
+	dr->adev = adev;
 	dr->handler = handler;
 	dr->handler_type = handler_type;
 	devres_add(dev, dr);




             reply	other threads:[~2026-06-03 18:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03 18:26 Rafael J. Wysocki [this message]
2026-06-04  7:45 ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2841496.mvXUDI8C0e@rafael.j.wysocki \
    --to=rafael@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®