aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/hed.c
diff options
context:
space:
mode:
authorMichal Wilczynski <[email protected]>2023-07-03 08:02:49 +0000
committerRafael J. Wysocki <[email protected]>2023-07-14 16:58:34 +0000
commit898ff0f005bada644913fc0e463ff9b9ff6d6ff3 (patch)
tree4a35e6b39ad5603771125c69f2a9e3926c205ea6 /drivers/acpi/hed.c
parentACPI: battery: Install Notify() handler directly (diff)
downloadkernel-898ff0f005bada644913fc0e463ff9b9ff6d6ff3.tar.gz
kernel-898ff0f005bada644913fc0e463ff9b9ff6d6ff3.zip
ACPI: HED: Install Notify() handler directly
Modify the ACPI HED driver to install its own Notify() handler directly instead of providing an ACPI driver .notify() callback. This will allow the ACPI driver .notify() callback to be eliminated and it will allow the HED driver to be switched over to a platform one in the future. Suggested-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Michal Wilczynski <[email protected]> [ rjw: Subject and changelog edits, whitespace adjustments ] Signed-off-by: Rafael J. Wysocki <[email protected]>
Diffstat (limited to 'drivers/acpi/hed.c')
-rw-r--r--drivers/acpi/hed.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/acpi/hed.c b/drivers/acpi/hed.c
index 78d44e3fe129..46c6f8c35b43 100644
--- a/drivers/acpi/hed.c
+++ b/drivers/acpi/hed.c
@@ -42,22 +42,32 @@ EXPORT_SYMBOL_GPL(unregister_acpi_hed_notifier);
* it is used by HEST Generic Hardware Error Source with notify type
* SCI.
*/
-static void acpi_hed_notify(struct acpi_device *device, u32 event)
+static void acpi_hed_notify(acpi_handle handle, u32 event, void *data)
{
blocking_notifier_call_chain(&acpi_hed_notify_list, 0, NULL);
}
static int acpi_hed_add(struct acpi_device *device)
{
+ int err;
+
/* Only one hardware error device */
if (hed_handle)
return -EINVAL;
hed_handle = device->handle;
- return 0;
+
+ err = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
+ acpi_hed_notify);
+ if (err)
+ hed_handle = NULL;
+
+ return err;
}
static void acpi_hed_remove(struct acpi_device *device)
{
+ acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY,
+ acpi_hed_notify);
hed_handle = NULL;
}
@@ -68,7 +78,6 @@ static struct acpi_driver acpi_hed_driver = {
.ops = {
.add = acpi_hed_add,
.remove = acpi_hed_remove,
- .notify = acpi_hed_notify,
},
};
module_acpi_driver(acpi_hed_driver);