From c415cddd65a56218cd56254b23f977e744253bff Mon Sep 17 00:00:00 2001 From: Anson Huang Date: Tue, 26 Jun 2018 13:45:28 +0800 Subject: [PATCH] MLK-18687-2 thermal: imx_sc: add status check for thermal zone Add status check for thermal zones, ignore those thermal zones with status set to "disabled". Signed-off-by: Anson Huang Acked-by: Leonard Crestez --- drivers/thermal/imx_sc_thermal.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c index 21f8c2ac214d..8c5049020cd8 100644 --- a/drivers/thermal/imx_sc_thermal.c +++ b/drivers/thermal/imx_sc_thermal.c @@ -132,6 +132,7 @@ MODULE_DEVICE_TABLE(of, imx_sc_tsens_table); static int imx_sc_tsens_probe(struct platform_device *pdev) { + struct device_node *tz_np, *child_tz_np = NULL; struct device_node *np = pdev->dev.of_node; struct imx_sc_tsens_device *tsens_dev; struct imx_sc_sensor *sensor; @@ -169,7 +170,15 @@ static int imx_sc_tsens_probe(struct platform_device *pdev) tsens_dev->sensor_num = tsens_num; + tz_np = of_find_node_by_name(NULL, "thermal-zones"); + if (!tz_np) + return -ENODEV; + for (sensor_id = 0; sensor_id < tsens_num; sensor_id++) { + child_tz_np = of_get_next_child(tz_np, child_tz_np); + if (!of_device_is_available(child_tz_np)) + continue; + sensor = &tsens_dev->sensor[sensor_id]; sensor->hw_id = sensor_hw_id[sensor_id]; tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, sensor_id, sensor,