Merge tag 'gcc-plugins-v4.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git...
[cascardo/linux.git] / drivers / thermal / of-thermal.c
index 20822ab..d04ec3b 100644 (file)
@@ -192,9 +192,6 @@ static int of_thermal_set_emul_temp(struct thermal_zone_device *tz,
 {
        struct __thermal_zone *data = tz->devdata;
 
-       if (!data->ops || !data->ops->set_emul_temp)
-               return -EINVAL;
-
        return data->ops->set_emul_temp(data->sensor_data, temp);
 }
 
@@ -289,7 +286,7 @@ static int of_thermal_set_mode(struct thermal_zone_device *tz,
        mutex_unlock(&tz->lock);
 
        data->mode = mode;
-       thermal_zone_device_update(tz);
+       thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
 
        return 0;
 }
@@ -432,7 +429,9 @@ thermal_zone_of_add_sensor(struct device_node *zone,
        if (ops->set_trips)
                tzd->ops->set_trips = of_thermal_set_trips;
 
-       tzd->ops->set_emul_temp = of_thermal_set_emul_temp;
+       if (ops->set_emul_temp)
+               tzd->ops->set_emul_temp = of_thermal_set_emul_temp;
+
        mutex_unlock(&tzd->lock);
 
        return tzd;
@@ -601,7 +600,7 @@ static int devm_thermal_zone_of_sensor_match(struct device *dev, void *res,
  * Return: On success returns a valid struct thermal_zone_device,
  * otherwise, it returns a corresponding ERR_PTR(). Caller must
  * check the return value with help of IS_ERR() helper.
- * Registered hermal_zone_device device will automatically be
+ * Registered thermal_zone_device device will automatically be
  * released when device is unbounded.
  */
 struct thermal_zone_device *devm_thermal_zone_of_sensor_register(