@@ -879,6 +879,8 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
.get_crit_temp = thermal_get_crit_temp,
.get_trend = thermal_get_trend,
.notify = thermal_notify,
+
+ .set_mode_skip_check = true,
};
static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
@@ -198,8 +198,6 @@ static int mlxsw_thermal_set_mode(struct thermal_zone_device *tzdev,
thermal->mode = mode;
- thermal_zone_device_check(tzdev);
-
return 0;
}
@@ -495,6 +495,8 @@ static int acerhdf_get_crit_temp(struct thermal_zone_device *thermal,
.get_trip_hyst = acerhdf_get_trip_hyst,
.get_trip_temp = acerhdf_get_trip_temp,
.get_crit_temp = acerhdf_get_crit_temp,
+
+ .set_mode_skip_check = true,
};
@@ -228,6 +228,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle(tz, true);
+ thermal_zone_device_check(tz);
/*
* right now the FW does set up the HW-block, so we are not
@@ -337,6 +337,7 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle(thermal, true);
+ thermal_zone_device_check(thermal);
priv->thermal = thermal;
@@ -72,6 +72,7 @@ static int ns_thermal_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle(ns_thermal->tz, true);
+ thermal_zone_device_check(ns_thermal->tz);
platform_set_drvdata(pdev, ns_thermal);
@@ -220,6 +220,8 @@ static int db8500_sys_get_crit_temp(struct thermal_zone_device *thermal,
.get_trip_type = db8500_sys_get_trip_type,
.get_trip_temp = db8500_sys_get_trip_temp,
.get_crit_temp = db8500_sys_get_crit_temp,
+
+ .set_mode_skip_check = true,
};
static void db8500_thermal_update_config(struct db8500_thermal_zone *pzone,
@@ -489,6 +489,7 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev,
}
thermal_zone_device_toggle(sensor->tzd, true);
+ thermal_zone_device_check(sensor->tzd);
trip = of_thermal_get_trip_points(sensor->tzd);
@@ -563,6 +564,7 @@ static int hisi_thermal_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle((&data->sensor)->tzd, true);
+ thermal_zone_device_check((&data->sensor)->tzd);
return 0;
}
@@ -572,6 +574,7 @@ static int hisi_thermal_remove(struct platform_device *pdev)
struct hisi_thermal_data *data = platform_get_drvdata(pdev);
thermal_zone_device_toggle((&data->sensor)->tzd, false);
+ thermal_zone_device_check((&data->sensor)->tzd);
data->disable_sensor(data);
@@ -389,8 +389,6 @@ static int imx_set_mode(struct thermal_zone_device *tz,
data->mode = mode;
- thermal_zone_device_check(tz);
-
return 0;
}
@@ -305,6 +305,7 @@ static int int3400_thermal_probe(struct platform_device *pdev)
if (priv->uuid_bitmap & 1 << INT3400_THERMAL_PASSIVE_1) {
int3400_thermal_ops.get_mode = int3400_thermal_get_mode;
int3400_thermal_ops.set_mode = int3400_thermal_set_mode;
+ int3400_thermal_ops.set_mode_skip_check = true;
}
priv->thermal = thermal_zone_device_register("INT3400 Thermal", 0, 0,
priv, &int3400_thermal_ops,
@@ -126,6 +126,7 @@ static int max77620_thermal_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle(mtherm->tz_device, true);
+ thermal_zone_device_check(mtherm->tz_device);
ret = devm_request_threaded_irq(&pdev->dev, mtherm->irq_tjalarm1, NULL,
max77620_thermal_irq,
@@ -770,6 +770,7 @@ static int mtk_thermal_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle(tzdev, true);
+ thermal_zone_device_check(tzdev);
return 0;
@@ -286,8 +286,6 @@ static int of_thermal_set_mode(struct thermal_zone_device *tz,
data->mode = mode;
- thermal_zone_device_check(tz);
-
return 0;
}
@@ -271,6 +271,7 @@ static int qpnp_tm_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle(chip->tz_dev, true);
+ thermal_zone_device_check(chip->tz_dev);
return 0;
}
@@ -103,6 +103,7 @@ static int tsens_register(struct tsens_device *tmdev)
continue;
thermal_zone_device_toggle(tzd, true);
+ thermal_zone_device_check(tzd);
tmdev->sensor[i].tzd = tzd;
@@ -243,6 +243,7 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle(data->tz, true);
+ thermal_zone_device_check(data->tz);
/* Enable monitoring */
site |= 0x1 << (15 - data->sensor_id);
@@ -430,6 +430,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle(zone, true);
+ thermal_zone_device_check(zone);
tsc->zone = zone;
@@ -514,8 +514,10 @@ static int rcar_thermal_probe(struct platform_device *pdev)
goto error_unregister;
}
- if (rcar_use_of_thermal(dev))
+ if (rcar_use_of_thermal(dev)) {
thermal_zone_device_toggle(priv->zone, true);
+ thermal_zone_device_check(priv->zone);
+ }
if (rcar_use_of_thermal(dev)) {
/*
@@ -1162,6 +1162,7 @@ static int rockchip_configure_from_dt(struct device *dev,
}
thermal_zone_device_toggle(sensor->tzd, true);
+ thermal_zone_device_check(sensor->tzd);
return 0;
}
@@ -1283,8 +1284,10 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
thermal->chip->control(thermal->regs, true);
- for (i = 0; i < thermal->chip->chn_num; i++)
+ for (i = 0; i < thermal->chip->chn_num; i++) {
thermal_zone_device_toggle((&thermal->sensors[i])->tzd, true);
+ thermal_zone_device_check((&thermal->sensors[i])->tzd);
+ }
platform_set_drvdata(pdev, thermal);
@@ -1303,8 +1306,10 @@ static int rockchip_thermal_remove(struct platform_device *pdev)
struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
int i;
- for (i = 0; i < thermal->chip->chn_num; i++)
+ for (i = 0; i < thermal->chip->chn_num; i++) {
thermal_zone_device_toggle((&thermal->sensors[i])->tzd, false);
+ thermal_zone_device_check((&thermal->sensors[i])->tzd);
+ }
thermal->chip->control(thermal->regs, false);
@@ -1320,8 +1325,10 @@ static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
int i;
- for (i = 0; i < thermal->chip->chn_num; i++)
+ for (i = 0; i < thermal->chip->chn_num; i++) {
thermal_zone_device_toggle((&thermal->sensors[i])->tzd, false);
+ thermal_zone_device_check((&thermal->sensors[i])->tzd);
+ }
thermal->chip->control(thermal->regs, false);
@@ -1371,8 +1378,10 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev)
thermal->chip->control(thermal->regs, true);
- for (i = 0; i < thermal->chip->chn_num; i++)
+ for (i = 0; i < thermal->chip->chn_num; i++) {
thermal_zone_device_toggle((&thermal->sensors[i])->tzd, true);
+ thermal_zone_device_check((&thermal->sensors[i])->tzd);
+ }
pinctrl_pm_select_default_state(dev);
@@ -1404,6 +1404,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle(data->tzd, true);
+ thermal_zone_device_check(data->tzd);
ret = exynos_tmu_initialize(pdev);
if (ret) {
@@ -90,8 +90,10 @@ static int tango_thermal_probe(struct platform_device *pdev)
tango_thermal_init(priv);
tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv, &ops);
- if (!IS_ERR(tzdev))
+ if (!IS_ERR(tzdev)) {
thermal_zone_device_toggle(tzdev, true);
+ thermal_zone_device_check(tzdev);
+ }
return PTR_ERR_OR_ZERO(tzdev);
}
@@ -1401,6 +1401,7 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle(z, true);
+ thermal_zone_device_check(z);
zone->tz = z;
tegra->thermctl_tzs[soc->ttgs[i]->id] = z;
@@ -214,6 +214,7 @@ static int tegra_bpmp_thermal_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle(tzd, true);
+ thermal_zone_device_check(tzd);
zone->tzd = tzd;
INIT_WORK(&zone->tz_device_update_work,
@@ -143,6 +143,7 @@ static int gadc_thermal_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle(gti->tz_dev, true);
+ thermal_zone_device_check(gti->tz_dev);
return 0;
}
@@ -88,6 +88,9 @@
if (result)
return result;
+ if (!tz->ops->set_mode_skip_check)
+ thermal_zone_device_check(tz);
+
return count;
}
@@ -198,6 +198,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,
}
thermal_zone_device_toggle(data->ti_thermal, true);
+ thermal_zone_device_check(data->ti_thermal);
ti_bandgap_set_sensor_data(bgp, id, data);
ti_bandgap_write_update_interval(bgp, data->sensor_id,
@@ -308,6 +308,7 @@ static int uniphier_tm_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle(tdev->tz_dev, true);
+ thermal_zone_device_check(tdev->tz_dev);
/* get trip points */
trips = of_thermal_get_trip_points(tdev->tz_dev);
@@ -169,6 +169,7 @@ static int zx2967_thermal_probe(struct platform_device *pdev)
}
thermal_zone_device_toggle(priv->tzd, true);
+ thermal_zone_device_check(priv->tzd);
if (priv->tzd->tzp->slope == 0) {
thermal_zone_of_sensor_unregister(&pdev->dev, priv->tzd);
@@ -128,6 +128,8 @@ struct thermal_zone_device_ops {
enum thermal_trend *);
int (*notify) (struct thermal_zone_device *, int,
enum thermal_trip_type);
+
+ bool set_mode_skip_check;
};
struct thermal_cooling_device_ops {
* Add set_mode_skip_check flag to struct thermal_zone_device_ops and set it in drivers that don't check the thermal zone device in their ->set_mode method implementations. * Move thermal_zone_device_check() from ->set_mode implementations to the users of thermal_zone_device_toggle() (only place which calls ->set_mode). Modify mode_store() in thermal_sysfs.c accordingly. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> --- drivers/acpi/thermal.c | 2 ++ drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 2 -- drivers/platform/x86/acerhdf.c | 2 ++ drivers/thermal/broadcom/bcm2835_thermal.c | 1 + drivers/thermal/broadcom/brcmstb_thermal.c | 1 + drivers/thermal/broadcom/ns-thermal.c | 1 + drivers/thermal/db8500_thermal.c | 2 ++ drivers/thermal/hisi_thermal.c | 3 +++ drivers/thermal/imx_thermal.c | 2 -- drivers/thermal/int340x_thermal/int3400_thermal.c | 1 + drivers/thermal/max77620_thermal.c | 1 + drivers/thermal/mtk_thermal.c | 1 + drivers/thermal/of-thermal.c | 2 -- drivers/thermal/qcom-spmi-temp-alarm.c | 1 + drivers/thermal/qcom/tsens.c | 1 + drivers/thermal/qoriq_thermal.c | 1 + drivers/thermal/rcar_gen3_thermal.c | 1 + drivers/thermal/rcar_thermal.c | 4 +++- drivers/thermal/rockchip_thermal.c | 17 +++++++++++++---- drivers/thermal/samsung/exynos_tmu.c | 1 + drivers/thermal/tango_thermal.c | 4 +++- drivers/thermal/tegra/soctherm.c | 1 + drivers/thermal/tegra/tegra-bpmp-thermal.c | 1 + drivers/thermal/thermal-generic-adc.c | 1 + drivers/thermal/thermal_sysfs.c | 3 +++ drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 1 + drivers/thermal/uniphier_thermal.c | 1 + drivers/thermal/zx2967_thermal.c | 1 + include/linux/thermal.h | 2 ++ 29 files changed, 50 insertions(+), 12 deletions(-)