[tip: sched/core] sched/rt, dl: Convert functions to return bool

From: tip-bot2 for Qais Yousef
Date: Thu Aug 08 2024 - 06:14:47 EST


The following commit has been merged into the sched/core branch of tip:

Commit-ID: b166af3db70fdcecf125662a2360471bb20be203
Gitweb: https://git.kernel.org/tip/b166af3db70fdcecf125662a2360471bb20be203
Author: Qais Yousef <qyousef@xxxxxxxxxxx>
AuthorDate: Mon, 10 Jun 2024 20:20:17 +01:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Wed, 07 Aug 2024 18:32:38 +02:00

sched/rt, dl: Convert functions to return bool

{rt, realtime, dl}_{task, prio}() functions' return value is actually
a bool. Convert their return type to reflect that.

Suggested-by: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>
Signed-off-by: Qais Yousef <qyousef@xxxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
Reviewed-by: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>
Reviewed-by: Metin Kaya <metin.kaya@xxxxxxx>
Link: https://lore.kernel.org/r/20240610192018.1567075-3-qyousef@xxxxxxxxxxx
---
include/linux/sched/deadline.h | 8 +++-----
include/linux/sched/rt.h | 16 ++++++----------
2 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/include/linux/sched/deadline.h b/include/linux/sched/deadline.h
index 5cb88b7..3a912ab 100644
--- a/include/linux/sched/deadline.h
+++ b/include/linux/sched/deadline.h
@@ -10,18 +10,16 @@

#include <linux/sched.h>

-static inline int dl_prio(int prio)
+static inline bool dl_prio(int prio)
{
- if (unlikely(prio < MAX_DL_PRIO))
- return 1;
- return 0;
+ return unlikely(prio < MAX_DL_PRIO);
}

/*
* Returns true if a task has a priority that belongs to DL class. PI-boosted
* tasks will return true. Use dl_policy() to ignore PI-boosted tasks.
*/
-static inline int dl_task(struct task_struct *p)
+static inline bool dl_task(struct task_struct *p)
{
return dl_prio(p->prio);
}
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
index a055dd6..91ef1ef 100644
--- a/include/linux/sched/rt.h
+++ b/include/linux/sched/rt.h
@@ -6,25 +6,21 @@

struct task_struct;

-static inline int rt_prio(int prio)
+static inline bool rt_prio(int prio)
{
- if (unlikely(prio < MAX_RT_PRIO && prio >= MAX_DL_PRIO))
- return 1;
- return 0;
+ return unlikely(prio < MAX_RT_PRIO && prio >= MAX_DL_PRIO);
}

-static inline int realtime_prio(int prio)
+static inline bool realtime_prio(int prio)
{
- if (unlikely(prio < MAX_RT_PRIO))
- return 1;
- return 0;
+ return unlikely(prio < MAX_RT_PRIO);
}

/*
* Returns true if a task has a priority that belongs to RT class. PI-boosted
* tasks will return true. Use rt_policy() to ignore PI-boosted tasks.
*/
-static inline int rt_task(struct task_struct *p)
+static inline bool rt_task(struct task_struct *p)
{
return rt_prio(p->prio);
}
@@ -34,7 +30,7 @@ static inline int rt_task(struct task_struct *p)
* PI-boosted tasks will return true. Use realtime_task_policy() to ignore
* PI-boosted tasks.
*/
-static inline int realtime_task(struct task_struct *p)
+static inline bool realtime_task(struct task_struct *p)
{
return realtime_prio(p->prio);
}