These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / acpi / thermal.c
index d24fa19..82707f9 100644 (file)
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  *  General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  *  This driver fully implements the ACPI thermal policy as described in the
@@ -319,7 +315,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
                        if (crt == -1) {
                                tz->trips.critical.flags.valid = 0;
                        } else if (crt > 0) {
-                               unsigned long crt_k = CELSIUS_TO_KELVIN(crt);
+                               unsigned long crt_k = CELSIUS_TO_DECI_KELVIN(crt);
                                /*
                                 * Allow override critical threshold
                                 */
@@ -355,7 +351,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
                if (psv == -1) {
                        status = AE_SUPPORT;
                } else if (psv > 0) {
-                       tmp = CELSIUS_TO_KELVIN(psv);
+                       tmp = CELSIUS_TO_DECI_KELVIN(psv);
                        status = AE_OK;
                } else {
                        status = acpi_evaluate_integer(tz->device->handle,
@@ -435,7 +431,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
                                        break;
                                if (i == 1)
                                        tz->trips.active[0].temperature =
-                                               CELSIUS_TO_KELVIN(act);
+                                               CELSIUS_TO_DECI_KELVIN(act);
                                else
                                        /*
                                         * Don't allow override higher than
@@ -443,9 +439,9 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
                                         */
                                        tz->trips.active[i - 1].temperature =
                                                (tz->trips.active[i - 2].temperature <
-                                               CELSIUS_TO_KELVIN(act) ?
+                                               CELSIUS_TO_DECI_KELVIN(act) ?
                                                tz->trips.active[i - 2].temperature :
-                                               CELSIUS_TO_KELVIN(act));
+                                               CELSIUS_TO_DECI_KELVIN(act));
                                break;
                        } else {
                                tz->trips.active[i].temperature = tmp;
@@ -529,8 +525,7 @@ static void acpi_thermal_check(void *data)
 
 /* sys I/F for generic thermal sysfs support */
 
-static int thermal_get_temp(struct thermal_zone_device *thermal,
-                           unsigned long *temp)
+static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
 {
        struct acpi_thermal *tz = thermal->devdata;
        int result;
@@ -637,7 +632,7 @@ static int thermal_get_trip_type(struct thermal_zone_device *thermal,
 }
 
 static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
-                                int trip, unsigned long *temp)
+                                int trip, int *temp)
 {
        struct acpi_thermal *tz = thermal->devdata;
        int i;
@@ -690,7 +685,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
 }
 
 static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
-                               unsigned long *temperature) {
+                               int *temperature)
+{
        struct acpi_thermal *tz = thermal->devdata;
 
        if (tz->trips.critical.flags.valid) {
@@ -713,8 +709,8 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
                return -EINVAL;
 
        if (type == THERMAL_TRIP_ACTIVE) {
-               unsigned long trip_temp;
-               unsigned long temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(
+               int trip_temp;
+               int temp = DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(
                                        tz->temperature, tz->kelvin_offset);
                if (thermal_get_trip_temp(thermal, trip, &trip_temp))
                        return -EINVAL;
@@ -800,7 +796,8 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
                                result =
                                        thermal_zone_bind_cooling_device
                                        (thermal, trip, cdev,
-                                        THERMAL_NO_LIMIT, THERMAL_NO_LIMIT);
+                                        THERMAL_NO_LIMIT, THERMAL_NO_LIMIT,
+                                        THERMAL_WEIGHT_DEFAULT);
                        else
                                result =
                                        thermal_zone_unbind_cooling_device
@@ -824,7 +821,8 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
                        if (bind)
                                result = thermal_zone_bind_cooling_device
                                        (thermal, trip, cdev,
-                                        THERMAL_NO_LIMIT, THERMAL_NO_LIMIT);
+                                        THERMAL_NO_LIMIT, THERMAL_NO_LIMIT,
+                                        THERMAL_WEIGHT_DEFAULT);
                        else
                                result = thermal_zone_unbind_cooling_device
                                        (thermal, trip, cdev);
@@ -841,7 +839,8 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
                                result = thermal_zone_bind_cooling_device
                                                (thermal, THERMAL_TRIPS_NONE,
                                                 cdev, THERMAL_NO_LIMIT,
-                                                THERMAL_NO_LIMIT);
+                                                THERMAL_NO_LIMIT,
+                                                THERMAL_WEIGHT_DEFAULT);
                        else
                                result = thermal_zone_unbind_cooling_device
                                                (thermal, THERMAL_TRIPS_NONE,
@@ -1106,7 +1105,7 @@ static int acpi_thermal_add(struct acpi_device *device)
        INIT_WORK(&tz->thermal_check_work, acpi_thermal_check_fn);
 
        pr_info(PREFIX "%s [%s] (%ld C)\n", acpi_device_name(device),
-               acpi_device_bid(device), KELVIN_TO_CELSIUS(tz->temperature));
+               acpi_device_bid(device), DECI_KELVIN_TO_CELSIUS(tz->temperature));
        goto end;
 
 free_memory: