diff mbox series

[v5,2/2] sched/rt, dl: Convert functions to return bool

Message ID 20240604144228.1356121-3-qyousef@layalina.io (mailing list archive)
State New
Headers show
Series Clean up usage of rt_task() | expand

Commit Message

Qais Yousef June 4, 2024, 2:42 p.m. UTC
{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 |  8 +++-----
 include/linux/sched/rt.h       | 16 ++++++----------
 2 files changed, 9 insertions(+), 15 deletions(-)

Comments

Steven Rostedt June 4, 2024, 4:28 p.m. UTC | #1
On Tue,  4 Jun 2024 15:42:28 +0100
Qais Yousef <qyousef@layalina.io> wrote:

> {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 |  8 +++-----
>  include/linux/sched/rt.h       | 16 ++++++----------
>  2 files changed, 9 insertions(+), 15 deletions(-)

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve
Metin Kaya June 5, 2024, 6:54 a.m. UTC | #2
On 04/06/2024 3:42 pm, Qais Yousef wrote:
> {rt, realtime, dl}_{task, prio}() functions return value is actually

Super-nit: s/functions/functions'/ ?

With that,

Reviewed-by: Metin Kaya <metin.kaya@arm.com>

> 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 |  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 5cb88b748ad6..3a912ab42bb5 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 a055dd68a77c..91ef1ef2019f 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);
>   }
diff mbox series

Patch

diff --git a/include/linux/sched/deadline.h b/include/linux/sched/deadline.h
index 5cb88b748ad6..3a912ab42bb5 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 a055dd68a77c..91ef1ef2019f 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);
 }