Skip to contentSkip to conversation

sched: idle: s/int/bool for idle_timer: done

PATCH New Dhruva Gole 1 participant 1 message Aug 9, 2024 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sched: idle: s/int/bool for idle_timer: done

Since it->done takes only 1 or 0 throughout the code it makes sense to call it a bool variable than int. This will also help improve readability.

---

Changelog:

v1 --> v2:
Fixed $subject as the replace was written reverse. No logical changes.

Link to v1: https://lore.kernel.org/all/[email protected]/

 kernel/sched/idle.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/sched/idle.c +3 -3
index e53e2da04ba4..98eac397d667 100644
@@ -365,14 +365,14 @@ bool cpu_in_idle(unsigned long pc)
 
 struct idle_timer {
 	struct hrtimer timer;
-	int done;
+	bool done;
 };
 
 static enum hrtimer_restart idle_inject_timer_fn(struct hrtimer *timer)
 {
 	struct idle_timer *it = container_of(timer, struct idle_timer, timer);
 
-	WRITE_ONCE(it->done, 1);
+	WRITE_ONCE(it->done, true);
 	set_tsk_need_resched(current);
 
 	return HRTIMER_NORESTART;
@@ -398,7 +398,7 @@ void play_idle_precise(u64 duration_ns, u64 latency_ns)
 	current->flags |= PF_IDLE;
 	cpuidle_use_deepest_state(latency_ns);
 
-	it.done = 0;
+	it.done = false;
 	hrtimer_init_on_stack(&it.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
 	it.timer.function = idle_inject_timer_fn;
 	hrtimer_start(&it.timer, ns_to_ktime(duration_ns),

base-commit: 61c01d2e181adfba02fe09764f9fca1de2be0dbe

Signature · 1 line
2.34.1