[PATCH -next RFC -v2 03/11] cpuset: change return type of is_partition_[in]valid to bool

Chen Ridong posted 11 patches 3 weeks, 2 days ago
There is a newer version of this series
[PATCH -next RFC -v2 03/11] cpuset: change return type of is_partition_[in]valid to bool
Posted by Chen Ridong 3 weeks, 2 days ago
From: Chen Ridong <chenridong@huawei.com>

The functions is_partition_valid() and is_partition_invalid() logically
return boolean values, but were previously declared with return type
'int'. This patch changes their return type to 'bool' to better reflect
their semantic meaning and improve type safety.

Signed-off-by: Chen Ridong <chenridong@huawei.com>
---
 kernel/cgroup/cpuset.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index d21c448a35e1..a31b05f58e0e 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -159,12 +159,12 @@ void dec_dl_tasks_cs(struct task_struct *p)
 	cs->nr_deadline_tasks--;
 }
 
-static inline int is_partition_valid(const struct cpuset *cs)
+static inline bool is_partition_valid(const struct cpuset *cs)
 {
 	return cs->partition_root_state > 0;
 }
 
-static inline int is_partition_invalid(const struct cpuset *cs)
+static inline bool is_partition_invalid(const struct cpuset *cs)
 {
 	return cs->partition_root_state < 0;
 }
-- 
2.34.1
Re: [PATCH -next RFC -v2 03/11] cpuset: change return type of is_partition_[in]valid to bool
Posted by Waiman Long 2 weeks, 3 days ago
On 9/8/25 11:32 PM, Chen Ridong wrote:
> From: Chen Ridong <chenridong@huawei.com>
>
> The functions is_partition_valid() and is_partition_invalid() logically
> return boolean values, but were previously declared with return type
> 'int'. This patch changes their return type to 'bool' to better reflect
> their semantic meaning and improve type safety.
>
> Signed-off-by: Chen Ridong <chenridong@huawei.com>
> ---
>   kernel/cgroup/cpuset.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index d21c448a35e1..a31b05f58e0e 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -159,12 +159,12 @@ void dec_dl_tasks_cs(struct task_struct *p)
>   	cs->nr_deadline_tasks--;
>   }
>   
> -static inline int is_partition_valid(const struct cpuset *cs)
> +static inline bool is_partition_valid(const struct cpuset *cs)
>   {
>   	return cs->partition_root_state > 0;
>   }
>   
> -static inline int is_partition_invalid(const struct cpuset *cs)
> +static inline bool is_partition_invalid(const struct cpuset *cs)
>   {
>   	return cs->partition_root_state < 0;
>   }
Reviewed-by: Waiman Long <longman@redhat.com>