Skip to content

Commit 9d67b6a

Browse files
mwilczyrafaeljw
authored andcommitted
ACPI: thermal: Install Notify() handler directly
Modify the ACPI thermal 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 thermal driver to be switched over to a platform one in the future. While at it, fix up whitespaces in acpi_thermal_remove(). Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com> [ rjw: Subject and changelog edits, whitespace adjustments ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 1c28250 commit 9d67b6a

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

drivers/acpi/thermal.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,9 @@ static void acpi_queue_thermal_check(struct acpi_thermal *tz)
825825
queue_work(acpi_thermal_pm_queue, &tz->thermal_check_work);
826826
}
827827

828-
static void acpi_thermal_notify(struct acpi_device *device, u32 event)
828+
static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
829829
{
830+
struct acpi_device *device = data;
830831
struct acpi_thermal *tz = acpi_driver_data(device);
831832

832833
if (!tz)
@@ -997,11 +998,20 @@ static int acpi_thermal_add(struct acpi_device *device)
997998

998999
pr_info("%s [%s] (%ld C)\n", acpi_device_name(device),
9991000
acpi_device_bid(device), deci_kelvin_to_celsius(tz->temperature));
1000-
goto end;
10011001

1002+
result = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
1003+
acpi_thermal_notify);
1004+
if (result)
1005+
goto flush_wq;
1006+
1007+
return 0;
1008+
1009+
flush_wq:
1010+
flush_workqueue(acpi_thermal_pm_queue);
1011+
acpi_thermal_unregister_thermal_zone(tz);
10021012
free_memory:
10031013
kfree(tz);
1004-
end:
1014+
10051015
return result;
10061016
}
10071017

@@ -1012,10 +1022,14 @@ static void acpi_thermal_remove(struct acpi_device *device)
10121022
if (!device || !acpi_driver_data(device))
10131023
return;
10141024

1015-
flush_workqueue(acpi_thermal_pm_queue);
10161025
tz = acpi_driver_data(device);
10171026

1027+
acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY,
1028+
acpi_thermal_notify);
1029+
1030+
flush_workqueue(acpi_thermal_pm_queue);
10181031
acpi_thermal_unregister_thermal_zone(tz);
1032+
10191033
kfree(tz);
10201034
}
10211035

@@ -1078,7 +1092,6 @@ static struct acpi_driver acpi_thermal_driver = {
10781092
.ops = {
10791093
.add = acpi_thermal_add,
10801094
.remove = acpi_thermal_remove,
1081-
.notify = acpi_thermal_notify,
10821095
},
10831096
.drv.pm = &acpi_thermal_pm,
10841097
};

0 commit comments

Comments
 (0)