Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 8f9025b

Browse files
committed
thermal/debugfs: Move some statements from under thermal_dbg->lock
The tz_dbg local variable assignments in thermal_debug_tz_trip_up(), thermal_debug_tz_trip_down(), and thermal_debug_update_trip_stats() need not be carried out under thermal_dbg->lock, so move them from under that lock (to avoid possible future confusion). While at it, reorder local variable definitions in thermal_debug_tz_trip_up() for more clarity. No functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
1 parent 881c084 commit 8f9025b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/thermal/thermal_debugfs.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -574,20 +574,20 @@ static struct tz_episode *thermal_debugfs_tz_event_alloc(struct thermal_zone_dev
574574
void thermal_debug_tz_trip_up(struct thermal_zone_device *tz,
575575
const struct thermal_trip *trip)
576576
{
577-
struct tz_episode *tze;
578-
struct tz_debugfs *tz_dbg;
579577
struct thermal_debugfs *thermal_dbg = tz->debugfs;
580578
int trip_id = thermal_zone_trip_id(tz, trip);
581579
ktime_t now = ktime_get();
582580
struct trip_stats *trip_stats;
581+
struct tz_debugfs *tz_dbg;
582+
struct tz_episode *tze;
583583

584584
if (!thermal_dbg)
585585
return;
586586

587-
mutex_lock(&thermal_dbg->lock);
588-
589587
tz_dbg = &thermal_dbg->tz_dbg;
590588

589+
mutex_lock(&thermal_dbg->lock);
590+
591591
/*
592592
* The mitigation is starting. A mitigation can contain
593593
* several episodes where each of them is related to a
@@ -677,10 +677,10 @@ void thermal_debug_tz_trip_down(struct thermal_zone_device *tz,
677677
if (!thermal_dbg)
678678
return;
679679

680-
mutex_lock(&thermal_dbg->lock);
681-
682680
tz_dbg = &thermal_dbg->tz_dbg;
683681

682+
mutex_lock(&thermal_dbg->lock);
683+
684684
/*
685685
* The temperature crosses the way down but there was not
686686
* mitigation detected before. That may happen when the
@@ -729,10 +729,10 @@ void thermal_debug_update_trip_stats(struct thermal_zone_device *tz)
729729
if (!thermal_dbg)
730730
return;
731731

732-
mutex_lock(&thermal_dbg->lock);
733-
734732
tz_dbg = &thermal_dbg->tz_dbg;
735733

734+
mutex_lock(&thermal_dbg->lock);
735+
736736
if (!tz_dbg->nr_trips)
737737
goto out;
738738

0 commit comments

Comments
 (0)