diff options
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r-- | drivers/acpi/thermal.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 7dbebea1ec31..edda74a43406 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -98,7 +98,6 @@ MODULE_PARM_DESC(psv, "Disable or override all passive trip points."); | |||
98 | 98 | ||
99 | static int acpi_thermal_add(struct acpi_device *device); | 99 | static int acpi_thermal_add(struct acpi_device *device); |
100 | static int acpi_thermal_remove(struct acpi_device *device, int type); | 100 | static int acpi_thermal_remove(struct acpi_device *device, int type); |
101 | static int acpi_thermal_resume(struct acpi_device *device); | ||
102 | static void acpi_thermal_notify(struct acpi_device *device, u32 event); | 101 | static void acpi_thermal_notify(struct acpi_device *device, u32 event); |
103 | 102 | ||
104 | static const struct acpi_device_id thermal_device_ids[] = { | 103 | static const struct acpi_device_id thermal_device_ids[] = { |
@@ -107,6 +106,11 @@ static const struct acpi_device_id thermal_device_ids[] = { | |||
107 | }; | 106 | }; |
108 | MODULE_DEVICE_TABLE(acpi, thermal_device_ids); | 107 | MODULE_DEVICE_TABLE(acpi, thermal_device_ids); |
109 | 108 | ||
109 | #ifdef CONFIG_PM_SLEEP | ||
110 | static int acpi_thermal_resume(struct device *dev); | ||
111 | #endif | ||
112 | static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, NULL, acpi_thermal_resume); | ||
113 | |||
110 | static struct acpi_driver acpi_thermal_driver = { | 114 | static struct acpi_driver acpi_thermal_driver = { |
111 | .name = "thermal", | 115 | .name = "thermal", |
112 | .class = ACPI_THERMAL_CLASS, | 116 | .class = ACPI_THERMAL_CLASS, |
@@ -114,9 +118,9 @@ static struct acpi_driver acpi_thermal_driver = { | |||
114 | .ops = { | 118 | .ops = { |
115 | .add = acpi_thermal_add, | 119 | .add = acpi_thermal_add, |
116 | .remove = acpi_thermal_remove, | 120 | .remove = acpi_thermal_remove, |
117 | .resume = acpi_thermal_resume, | ||
118 | .notify = acpi_thermal_notify, | 121 | .notify = acpi_thermal_notify, |
119 | }, | 122 | }, |
123 | .drv.pm = &acpi_thermal_pm, | ||
120 | }; | 124 | }; |
121 | 125 | ||
122 | struct acpi_thermal_state { | 126 | struct acpi_thermal_state { |
@@ -550,8 +554,6 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, | |||
550 | return 0; | 554 | return 0; |
551 | } | 555 | } |
552 | 556 | ||
553 | static const char enabled[] = "kernel"; | ||
554 | static const char disabled[] = "user"; | ||
555 | static int thermal_get_mode(struct thermal_zone_device *thermal, | 557 | static int thermal_get_mode(struct thermal_zone_device *thermal, |
556 | enum thermal_device_mode *mode) | 558 | enum thermal_device_mode *mode) |
557 | { | 559 | { |
@@ -588,8 +590,8 @@ static int thermal_set_mode(struct thermal_zone_device *thermal, | |||
588 | if (enable != tz->tz_enabled) { | 590 | if (enable != tz->tz_enabled) { |
589 | tz->tz_enabled = enable; | 591 | tz->tz_enabled = enable; |
590 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 592 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
591 | "%s ACPI thermal control\n", | 593 | "%s kernel ACPI thermal control\n", |
592 | tz->tz_enabled ? enabled : disabled)); | 594 | tz->tz_enabled ? "Enable" : "Disable")); |
593 | acpi_thermal_check(tz); | 595 | acpi_thermal_check(tz); |
594 | } | 596 | } |
595 | return 0; | 597 | return 0; |
@@ -845,7 +847,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | |||
845 | 847 | ||
846 | if (tz->trips.passive.flags.valid) | 848 | if (tz->trips.passive.flags.valid) |
847 | tz->thermal_zone = | 849 | tz->thermal_zone = |
848 | thermal_zone_device_register("acpitz", trips, tz, | 850 | thermal_zone_device_register("acpitz", trips, 0, tz, |
849 | &acpi_thermal_zone_ops, | 851 | &acpi_thermal_zone_ops, |
850 | tz->trips.passive.tc1, | 852 | tz->trips.passive.tc1, |
851 | tz->trips.passive.tc2, | 853 | tz->trips.passive.tc2, |
@@ -853,7 +855,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | |||
853 | tz->polling_frequency*100); | 855 | tz->polling_frequency*100); |
854 | else | 856 | else |
855 | tz->thermal_zone = | 857 | tz->thermal_zone = |
856 | thermal_zone_device_register("acpitz", trips, tz, | 858 | thermal_zone_device_register("acpitz", trips, 0, tz, |
857 | &acpi_thermal_zone_ops, | 859 | &acpi_thermal_zone_ops, |
858 | 0, 0, 0, | 860 | 0, 0, 0, |
859 | tz->polling_frequency*100); | 861 | tz->polling_frequency*100); |
@@ -1041,16 +1043,18 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) | |||
1041 | return 0; | 1043 | return 0; |
1042 | } | 1044 | } |
1043 | 1045 | ||
1044 | static int acpi_thermal_resume(struct acpi_device *device) | 1046 | #ifdef CONFIG_PM_SLEEP |
1047 | static int acpi_thermal_resume(struct device *dev) | ||
1045 | { | 1048 | { |
1046 | struct acpi_thermal *tz = NULL; | 1049 | struct acpi_thermal *tz; |
1047 | int i, j, power_state, result; | 1050 | int i, j, power_state, result; |
1048 | 1051 | ||
1049 | 1052 | if (!dev) | |
1050 | if (!device || !acpi_driver_data(device)) | ||
1051 | return -EINVAL; | 1053 | return -EINVAL; |
1052 | 1054 | ||
1053 | tz = acpi_driver_data(device); | 1055 | tz = acpi_driver_data(to_acpi_device(dev)); |
1056 | if (!tz) | ||
1057 | return -EINVAL; | ||
1054 | 1058 | ||
1055 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { | 1059 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { |
1056 | if (!(&tz->trips.active[i])) | 1060 | if (!(&tz->trips.active[i])) |
@@ -1074,6 +1078,7 @@ static int acpi_thermal_resume(struct acpi_device *device) | |||
1074 | 1078 | ||
1075 | return AE_OK; | 1079 | return AE_OK; |
1076 | } | 1080 | } |
1081 | #endif | ||
1077 | 1082 | ||
1078 | static int thermal_act(const struct dmi_system_id *d) { | 1083 | static int thermal_act(const struct dmi_system_id *d) { |
1079 | 1084 | ||