summaryrefslogtreecommitdiff
path: root/drivers/thermal/imx_thermal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/thermal/imx_thermal.c')
-rw-r--r--drivers/thermal/imx_thermal.c51
1 files changed, 14 insertions, 37 deletions
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index fb0d5cab70af..dbc1649f7bf3 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -252,7 +252,7 @@ static void imx_set_alarm_temp(struct imx_thermal_data *data,
static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
{
- struct imx_thermal_data *data = tz->devdata;
+ struct imx_thermal_data *data = thermal_zone_device_priv(tz);
const struct thermal_soc_data *soc_data = data->socdata;
struct regmap *map = data->tempmon;
unsigned int n_meas;
@@ -265,10 +265,8 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
regmap_read(map, soc_data->temp_data, &val);
- if ((val & soc_data->temp_valid_mask) == 0) {
- dev_dbg(&tz->device, "temp measurement never finished\n");
+ if ((val & soc_data->temp_valid_mask) == 0)
return -EAGAIN;
- }
n_meas = (val & soc_data->temp_value_mask)
>> soc_data->temp_value_shift;
@@ -287,13 +285,13 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
if (data->alarm_temp == trips[IMX_TRIP_CRITICAL].temperature &&
*temp < trips[IMX_TRIP_PASSIVE].temperature) {
imx_set_alarm_temp(data, trips[IMX_TRIP_PASSIVE].temperature);
- dev_dbg(&tz->device, "thermal alarm off: T < %d\n",
+ dev_dbg(data->dev, "thermal alarm off: T < %d\n",
data->alarm_temp / 1000);
}
}
if (*temp != data->last_temp) {
- dev_dbg(&tz->device, "millicelsius: %d\n", *temp);
+ dev_dbg(data->dev, "millicelsius: %d\n", *temp);
data->last_temp = *temp;
}
@@ -311,7 +309,7 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
static int imx_change_mode(struct thermal_zone_device *tz,
enum thermal_device_mode mode)
{
- struct imx_thermal_data *data = tz->devdata;
+ struct imx_thermal_data *data = thermal_zone_device_priv(tz);
if (mode == THERMAL_DEVICE_ENABLED) {
pm_runtime_get(data->dev);
@@ -342,7 +340,7 @@ static int imx_get_crit_temp(struct thermal_zone_device *tz, int *temp)
static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
int temp)
{
- struct imx_thermal_data *data = tz->devdata;
+ struct imx_thermal_data *data = thermal_zone_device_priv(tz);
int ret;
ret = pm_runtime_resume_and_get(data->dev);
@@ -369,36 +367,16 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
static int imx_bind(struct thermal_zone_device *tz,
struct thermal_cooling_device *cdev)
{
- int ret;
-
- ret = thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev,
- THERMAL_NO_LIMIT,
- THERMAL_NO_LIMIT,
- THERMAL_WEIGHT_DEFAULT);
- if (ret) {
- dev_err(&tz->device,
- "binding zone %s with cdev %s failed:%d\n",
- tz->type, cdev->type, ret);
- return ret;
- }
-
- return 0;
+ return thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev,
+ THERMAL_NO_LIMIT,
+ THERMAL_NO_LIMIT,
+ THERMAL_WEIGHT_DEFAULT);
}
static int imx_unbind(struct thermal_zone_device *tz,
struct thermal_cooling_device *cdev)
{
- int ret;
-
- ret = thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev);
- if (ret) {
- dev_err(&tz->device,
- "unbinding zone %s with cdev %s failed:%d\n",
- tz->type, cdev->type, ret);
- return ret;
- }
-
- return 0;
+ return thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev);
}
static struct thermal_zone_device_ops imx_tz_ops = {
@@ -560,8 +538,7 @@ static irqreturn_t imx_thermal_alarm_irq_thread(int irq, void *dev)
{
struct imx_thermal_data *data = dev;
- dev_dbg(&data->tz->device, "THERMAL ALARM: T > %d\n",
- data->alarm_temp / 1000);
+ dev_dbg(data->dev, "THERMAL ALARM: T > %d\n", data->alarm_temp / 1000);
thermal_zone_device_update(data->tz, THERMAL_EVENT_UNSPECIFIED);
@@ -594,7 +571,7 @@ static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
np = of_get_cpu_node(data->policy->cpu, NULL);
- if (!np || !of_find_property(np, "#cooling-cells", NULL)) {
+ if (!np || !of_property_present(np, "#cooling-cells")) {
data->cdev = cpufreq_cooling_register(data->policy);
if (IS_ERR(data->cdev)) {
ret = PTR_ERR(data->cdev);
@@ -671,7 +648,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, data);
- if (of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) {
+ if (of_property_present(pdev->dev.of_node, "nvmem-cells")) {
ret = imx_init_from_nvmem_cells(pdev);
if (ret)
return dev_err_probe(&pdev->dev, ret,