From: Rafael J. Wysocki Date: Sun, 1 Mar 2026 13:18:05 +0000 (+0100) Subject: hwmon: (acpi_power_meter) Register ACPI notify handler directly X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a5445f75443dba37698f336c2b28daba606e86cf;p=thirdparty%2Flinux.git hwmon: (acpi_power_meter) Register ACPI notify handler directly To facilitate subsequent conversion of the driver to a platform one, make it install an ACPI notify handler directly instead of using a .notify() callback in struct acpi_driver. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Link: https://lore.kernel.org/r/2405555.ElGaqSPkdT@rafael.j.wysocki Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c index 49e57c20ef707..c010f55f7c7ba 100644 --- a/drivers/hwmon/acpi_power_meter.c +++ b/drivers/hwmon/acpi_power_meter.c @@ -814,8 +814,9 @@ end: } /* Handle ACPI event notifications */ -static void acpi_power_meter_notify(struct acpi_device *device, u32 event) +static void acpi_power_meter_notify(acpi_handle handle, u32 event, void *data) { + struct acpi_device *device = data; struct acpi_power_meter_resource *resource = acpi_driver_data(device); int res; @@ -936,9 +937,16 @@ static int acpi_power_meter_add(struct acpi_device *device) goto exit_remove; } + res = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY, + acpi_power_meter_notify, device); + if (res) + goto exit_hwmon; + res = 0; goto exit; +exit_hwmon: + hwmon_device_unregister(resource->hwmon_dev); exit_remove: remove_domain_devices(resource); exit_free_capability: @@ -953,6 +961,9 @@ static void acpi_power_meter_remove(struct acpi_device *device) { struct acpi_power_meter_resource *resource = acpi_driver_data(device); + acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY, + acpi_power_meter_notify); + if (!IS_ERR(resource->hwmon_dev)) hwmon_device_unregister(resource->hwmon_dev); @@ -984,7 +995,6 @@ static struct acpi_driver acpi_power_meter_driver = { .ops = { .add = acpi_power_meter_add, .remove = acpi_power_meter_remove, - .notify = acpi_power_meter_notify, }, .drv.pm = pm_sleep_ptr(&acpi_power_meter_pm), };