[PATCH] kernel: sched: idle: s/bool/int for done

From: Dhruva Gole
Date: Mon Aug 05 2024 - 06:01:35 EST


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.

Signed-off-by: Dhruva Gole <d-gole@xxxxxx>
---
kernel/sched/idle.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index e53e2da04ba4..98eac397d667 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -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: d6dbc9f56c3a70e915625b6f1887882c23dc5c91
--
2.34.1