Message ID | 20240527234508.1062360-4-qyousef@layalina.io (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Clean up usage of rt_task() | expand |
On 2024-05-28 00:45:08 [+0100], Qais Yousef wrote: > diff --git a/include/linux/sched/deadline.h b/include/linux/sched/deadline.h > index 5cb88b748ad6..87d2370dd3db 100644 > --- a/include/linux/sched/deadline.h > +++ b/include/linux/sched/deadline.h > @@ -10,7 +10,7 @@ > > #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; if we return a bool we should return true/ false. Sebastian
On 05/29/24 09:34, Sebastian Andrzej Siewior wrote: > On 2024-05-28 00:45:08 [+0100], Qais Yousef wrote: > > diff --git a/include/linux/sched/deadline.h b/include/linux/sched/deadline.h > > index 5cb88b748ad6..87d2370dd3db 100644 > > --- a/include/linux/sched/deadline.h > > +++ b/include/linux/sched/deadline.h > > @@ -10,7 +10,7 @@ > > > > #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; > > if we return a bool we should return true/ false. Right. Fixed. Thanks! -- Qais Yousef
diff --git a/include/linux/sched/deadline.h b/include/linux/sched/deadline.h index 5cb88b748ad6..87d2370dd3db 100644 --- a/include/linux/sched/deadline.h +++ b/include/linux/sched/deadline.h @@ -10,7 +10,7 @@ #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; @@ -21,7 +21,7 @@ static inline int dl_prio(int 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 a055dd68a77c..78da97cdac48 100644 --- a/include/linux/sched/rt.h +++ b/include/linux/sched/rt.h @@ -6,14 +6,14 @@ 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; } -static inline int realtime_prio(int prio) +static inline bool realtime_prio(int prio) { if (unlikely(prio < MAX_RT_PRIO)) return 1; @@ -24,7 +24,7 @@ static inline int realtime_prio(int 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 +34,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); }
{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@goodmis.org> Signed-off-by: Qais Yousef <qyousef@layalina.io> --- include/linux/sched/deadline.h | 4 ++-- include/linux/sched/rt.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)