From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Hans de Goede <hansg@kernel.org>
Subject: [PATCH v1 6/9] ACPI: event: Redefine acpi_notifier_call_chain()
Date: Thu, 05 Mar 2026 21:18:22 +0100 [thread overview]
Message-ID: <2914546.BEx9A2HvPv@rafael.j.wysocki> (raw)
In-Reply-To: <4505861.ejJDZkT8p0@rafael.j.wysocki>
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Notice that acpi_notifier_call_chain() only uses its device argument
to retrieve the pnp.device_class and pnp.bus_id values from there, so
it can be redefined to take pointers to those two strings as parameters
istead of a struct acpi_device pointer.
That allows all of its callers to pass a string literal as its first
argument, so they won't need to initialize pnp.device_class in
struct acpi_device objects operated by them any more, and its
signature becomes more similar to acpi_bus_generate_netlink_event()
then.
Update the code as per the above.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/ac.c | 3 ++-
drivers/acpi/acpi_video.c | 9 ++++++---
drivers/acpi/battery.c | 3 ++-
drivers/acpi/event.c | 7 ++++---
include/acpi/acpi_bus.h | 3 ++-
5 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 4985c8890609..2b500e89169f 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -133,7 +133,8 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
acpi_bus_generate_netlink_event(adev->pnp.device_class,
dev_name(&adev->dev), event,
(u32) ac->state);
- acpi_notifier_call_chain(adev, event, (u32) ac->state);
+ acpi_notifier_call_chain(ACPI_AC_CLASS, acpi_device_bid(adev),
+ event, ac->state);
power_supply_changed(ac->charger);
}
}
diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 4fc2e52401a6..be53afcfb948 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -1568,7 +1568,8 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
break;
}
- if (acpi_notifier_call_chain(device, event, 0))
+ if (acpi_notifier_call_chain(ACPI_VIDEO_CLASS, acpi_device_bid(device),
+ event, 0))
/* Something vetoed the keypress. */
keycode = 0;
@@ -1609,7 +1610,8 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
if (video_device->backlight)
backlight_force_update(video_device->backlight,
BACKLIGHT_UPDATE_HOTKEY);
- acpi_notifier_call_chain(device, event, 0);
+ acpi_notifier_call_chain(ACPI_VIDEO_CLASS, acpi_device_bid(device),
+ event, 0);
return;
}
@@ -1642,7 +1644,8 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
if (keycode)
may_report_brightness_keys = true;
- acpi_notifier_call_chain(device, event, 0);
+ acpi_notifier_call_chain(ACPI_VIDEO_CLASS, acpi_device_bid(device),
+ event, 0);
if (keycode && (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS)) {
input_report_key(input, keycode, 1);
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index acf5dd2177a1..1bfc4179e885 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -1081,7 +1081,8 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event,
acpi_battery_present(battery));
- acpi_notifier_call_chain(device, event, acpi_battery_present(battery));
+ acpi_notifier_call_chain(ACPI_BATTERY_CLASS, acpi_device_bid(device),
+ event, acpi_battery_present(battery));
/* acpi_battery_update could remove power_supply object */
if (old && battery->bat)
power_supply_changed(battery->bat);
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c
index 96a9aaaaf9f7..4d840d2e7b98 100644
--- a/drivers/acpi/event.c
+++ b/drivers/acpi/event.c
@@ -24,12 +24,13 @@
/* ACPI notifier chain */
static BLOCKING_NOTIFIER_HEAD(acpi_chain_head);
-int acpi_notifier_call_chain(struct acpi_device *dev, u32 type, u32 data)
+int acpi_notifier_call_chain(const char *device_class,
+ const char *bus_id, u32 type, u32 data)
{
struct acpi_bus_event event;
- strscpy(event.device_class, dev->pnp.device_class);
- strscpy(event.bus_id, dev->pnp.bus_id);
+ strscpy(event.device_class, device_class);
+ strscpy(event.bus_id, bus_id);
event.type = type;
event.data = data;
return (blocking_notifier_call_chain(&acpi_chain_head, 0, (void *)&event)
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index aad1a95e6863..ff14c9362122 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -625,7 +625,8 @@ int acpi_dev_install_notify_handler(struct acpi_device *adev,
void acpi_dev_remove_notify_handler(struct acpi_device *adev,
u32 handler_type,
acpi_notify_handler handler);
-extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
+extern int acpi_notifier_call_chain(const char *device_class,
+ const char *bus_id, u32 type, u32 data);
extern int register_acpi_notifier(struct notifier_block *);
extern int unregister_acpi_notifier(struct notifier_block *);
--
2.51.0
next prev parent reply other threads:[~2026-03-05 20:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 20:09 [PATCH v1 0/9] ACPI: driver: Cleanups and fixes, mostly related to acpi_device_name/class() Rafael J. Wysocki
2026-03-05 20:10 ` [PATCH v1 1/9] ACPI: AC: Get rid of unnecessary declarations Rafael J. Wysocki
2026-03-05 20:11 ` [PATCH v1 2/9] ACPI: PAD: Rearrange notify handler installation and removal Rafael J. Wysocki
2026-03-05 20:12 ` [PATCH v1 3/9] ACPI: video: Consolidate pnp.bus_id workarounds handling Rafael J. Wysocki
2026-03-05 20:16 ` [PATCH v1 4/9] ACPI: video: Rework checking for duplicate video bus devices Rafael J. Wysocki
2026-03-05 20:17 ` [PATCH v1 5/9] ACPI: driver: Do not set acpi_device_name() unnecessarily Rafael J. Wysocki
2026-03-05 20:18 ` Rafael J. Wysocki [this message]
2026-03-05 20:20 ` [PATCH v1 7/9] ACPI: driver: Avoid using pnp.device_class for netlink handling Rafael J. Wysocki
2026-03-05 20:21 ` [PATCH v1 8/9] ACPI: driver: Do not set acpi_device_class() unnecessarily Rafael J. Wysocki
2026-03-05 20:27 ` [PATCH v1 9/9] ACPI: AC: Define ACPI_AC_CLASS in one place Rafael J. Wysocki
2026-03-06 12:44 ` Ilpo Järvinen
2026-03-06 12:49 ` Rafael J. Wysocki
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=2914546.BEx9A2HvPv@rafael.j.wysocki \
--to=rafael@kernel.org \
--cc=hansg@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.