hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/thermal/st/st_thermal.c
....@@ -1,14 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * ST Thermal Sensor Driver core routines
34 * Author: Ajit Pal Singh <ajitpal.singh@st.com>
45 *
56 * Copyright (C) 2003-2014 STMicroelectronics (R&D) Limited
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
127 */
138
149 #include <linux/clk.h>
....@@ -251,11 +246,16 @@
251246 ret = PTR_ERR(sensor->thermal_dev);
252247 goto sensor_off;
253248 }
249
+ ret = thermal_zone_device_enable(sensor->thermal_dev);
250
+ if (ret)
251
+ goto tzd_unregister;
254252
255253 platform_set_drvdata(pdev, sensor);
256254
257255 return 0;
258256
257
+tzd_unregister:
258
+ thermal_zone_device_unregister(sensor->thermal_dev);
259259 sensor_off:
260260 st_thermal_sensor_off(sensor);
261261
....@@ -277,8 +277,7 @@
277277 #ifdef CONFIG_PM_SLEEP
278278 static int st_thermal_suspend(struct device *dev)
279279 {
280
- struct platform_device *pdev = to_platform_device(dev);
281
- struct st_thermal_sensor *sensor = platform_get_drvdata(pdev);
280
+ struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
282281
283282 return st_thermal_sensor_off(sensor);
284283 }
....@@ -286,8 +285,7 @@
286285 static int st_thermal_resume(struct device *dev)
287286 {
288287 int ret;
289
- struct platform_device *pdev = to_platform_device(dev);
290
- struct st_thermal_sensor *sensor = platform_get_drvdata(pdev);
288
+ struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
291289
292290 ret = st_thermal_sensor_on(sensor);
293291 if (ret)