Skip to content

Commit dec07d3

Browse files
dlezcanorafaeljw
authored andcommitted
thermal: Don't use 'device' internal thermal zone structure field
Some drivers are directly using the thermal zone's 'device' structure field. Use the driver device pointer instead of the thermal zone device when it is available. Remove the traces when they are duplicate with the traces in the core code. Cc: Jean Delvare <jdelvare@suse.com> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Balsam CHIHI <bchihi@baylibre.com> #Mediatek LVTS Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> #MediaTek LVTS Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 4a16c19 commit dec07d3

4 files changed

Lines changed: 13 additions & 34 deletions

File tree

drivers/thermal/imx_thermal.c

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,13 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
285285
if (data->alarm_temp == trips[IMX_TRIP_CRITICAL].temperature &&
286286
*temp < trips[IMX_TRIP_PASSIVE].temperature) {
287287
imx_set_alarm_temp(data, trips[IMX_TRIP_PASSIVE].temperature);
288-
dev_dbg(&tz->device, "thermal alarm off: T < %d\n",
288+
dev_dbg(data->dev, "thermal alarm off: T < %d\n",
289289
data->alarm_temp / 1000);
290290
}
291291
}
292292

293293
if (*temp != data->last_temp) {
294-
dev_dbg(&tz->device, "millicelsius: %d\n", *temp);
294+
dev_dbg(data->dev, "millicelsius: %d\n", *temp);
295295
data->last_temp = *temp;
296296
}
297297

@@ -367,36 +367,16 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
367367
static int imx_bind(struct thermal_zone_device *tz,
368368
struct thermal_cooling_device *cdev)
369369
{
370-
int ret;
371-
372-
ret = thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev,
373-
THERMAL_NO_LIMIT,
374-
THERMAL_NO_LIMIT,
375-
THERMAL_WEIGHT_DEFAULT);
376-
if (ret) {
377-
dev_err(&tz->device,
378-
"binding zone %s with cdev %s failed:%d\n",
379-
tz->type, cdev->type, ret);
380-
return ret;
381-
}
382-
383-
return 0;
370+
return thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev,
371+
THERMAL_NO_LIMIT,
372+
THERMAL_NO_LIMIT,
373+
THERMAL_WEIGHT_DEFAULT);
384374
}
385375

386376
static int imx_unbind(struct thermal_zone_device *tz,
387377
struct thermal_cooling_device *cdev)
388378
{
389-
int ret;
390-
391-
ret = thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev);
392-
if (ret) {
393-
dev_err(&tz->device,
394-
"unbinding zone %s with cdev %s failed:%d\n",
395-
tz->type, cdev->type, ret);
396-
return ret;
397-
}
398-
399-
return 0;
379+
return thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev);
400380
}
401381

402382
static struct thermal_zone_device_ops imx_tz_ops = {
@@ -558,8 +538,7 @@ static irqreturn_t imx_thermal_alarm_irq_thread(int irq, void *dev)
558538
{
559539
struct imx_thermal_data *data = dev;
560540

561-
dev_dbg(&data->tz->device, "THERMAL ALARM: T > %d\n",
562-
data->alarm_temp / 1000);
541+
dev_dbg(data->dev, "THERMAL ALARM: T > %d\n", data->alarm_temp / 1000);
563542

564543
thermal_zone_device_update(data->tz, THERMAL_EVENT_UNSPECIFIED);
565544

drivers/thermal/mediatek/lvts_thermal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
305305
* 14-0 : Raw temperature for threshold
306306
*/
307307
if (low != -INT_MAX) {
308-
dev_dbg(&tz->device, "Setting low limit temperature interrupt: %d\n", low);
308+
pr_debug("%s: Setting low limit temperature interrupt: %d\n", tz->type, low);
309309
writel(raw_low, LVTS_H2NTHRE(base));
310310
}
311311

@@ -318,7 +318,7 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
318318
*
319319
* 14-0 : Raw temperature for threshold
320320
*/
321-
dev_dbg(&tz->device, "Setting high limit temperature interrupt: %d\n", high);
321+
pr_debug("%s: Setting high limit temperature interrupt: %d\n", tz->type, high);
322322
writel(raw_high, LVTS_HTHRE(base));
323323

324324
return 0;

drivers/thermal/thermal_hwmon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,14 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
228228
hwmon = thermal_hwmon_lookup_by_type(tz);
229229
if (unlikely(!hwmon)) {
230230
/* Should never happen... */
231-
dev_dbg(&tz->device, "hwmon device lookup failed!\n");
231+
dev_dbg(hwmon->device, "hwmon device lookup failed!\n");
232232
return;
233233
}
234234

235235
temp = thermal_hwmon_lookup_temp(hwmon, tz);
236236
if (unlikely(!temp)) {
237237
/* Should never happen... */
238-
dev_dbg(&tz->device, "temperature input lookup failed!\n");
238+
dev_dbg(hwmon->device, "temperature input lookup failed!\n");
239239
return;
240240
}
241241

drivers/thermal/ti-soc-thermal/ti-thermal-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static void ti_thermal_work(struct work_struct *work)
4343

4444
thermal_zone_device_update(data->ti_thermal, THERMAL_EVENT_UNSPECIFIED);
4545

46-
dev_dbg(&data->ti_thermal->device, "updated thermal zone %s\n",
46+
dev_dbg(data->bgp->dev, "updated thermal zone %s\n",
4747
data->ti_thermal->type);
4848
}
4949

0 commit comments

Comments
 (0)