mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 20:42:29 -04:00
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 <rafael.j.wysocki@intel.com> Link: https://lore.kernel.org/r/2405555.ElGaqSPkdT@rafael.j.wysocki Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
committed by
Guenter Roeck
parent
de19682f9e
commit
a5445f7544
@@ -814,8 +814,9 @@ static int read_capabilities(struct acpi_power_meter_resource *resource)
|
||||
}
|
||||
|
||||
/* 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),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user