| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ST Thermal Sensor Driver core routines |
|---|
| 3 | 4 | * Author: Ajit Pal Singh <ajitpal.singh@st.com> |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * 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 | | - * |
|---|
| 12 | 7 | */ |
|---|
| 13 | 8 | |
|---|
| 14 | 9 | #include <linux/clk.h> |
|---|
| .. | .. |
|---|
| 251 | 246 | ret = PTR_ERR(sensor->thermal_dev); |
|---|
| 252 | 247 | goto sensor_off; |
|---|
| 253 | 248 | } |
|---|
| 249 | + ret = thermal_zone_device_enable(sensor->thermal_dev); |
|---|
| 250 | + if (ret) |
|---|
| 251 | + goto tzd_unregister; |
|---|
| 254 | 252 | |
|---|
| 255 | 253 | platform_set_drvdata(pdev, sensor); |
|---|
| 256 | 254 | |
|---|
| 257 | 255 | return 0; |
|---|
| 258 | 256 | |
|---|
| 257 | +tzd_unregister: |
|---|
| 258 | + thermal_zone_device_unregister(sensor->thermal_dev); |
|---|
| 259 | 259 | sensor_off: |
|---|
| 260 | 260 | st_thermal_sensor_off(sensor); |
|---|
| 261 | 261 | |
|---|
| .. | .. |
|---|
| 277 | 277 | #ifdef CONFIG_PM_SLEEP |
|---|
| 278 | 278 | static int st_thermal_suspend(struct device *dev) |
|---|
| 279 | 279 | { |
|---|
| 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); |
|---|
| 282 | 281 | |
|---|
| 283 | 282 | return st_thermal_sensor_off(sensor); |
|---|
| 284 | 283 | } |
|---|
| .. | .. |
|---|
| 286 | 285 | static int st_thermal_resume(struct device *dev) |
|---|
| 287 | 286 | { |
|---|
| 288 | 287 | 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); |
|---|
| 291 | 289 | |
|---|
| 292 | 290 | ret = st_thermal_sensor_on(sensor); |
|---|
| 293 | 291 | if (ret) |
|---|