diff mbox series

[v2,3/5] RDMA/rxe: Change the is_user member of struct rxe_cq to bool

Message ID 20210902084640.679744-4-yangx.jy@fujitsu.com (mailing list archive)
State Superseded
Delegated to: Jason Gunthorpe
Headers show
Series RDMA/rxe: Do some cleanup | expand

Commit Message

Xiao Yang Sept. 2, 2021, 8:46 a.m. UTC
Make all is_user members of struct rxe_sq/rxe_cq/rxe_srq/rxe_cq
has the same type.

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
---
 drivers/infiniband/sw/rxe/rxe_cq.c    | 3 +--
 drivers/infiniband/sw/rxe/rxe_verbs.h | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

Comments

Jason Gunthorpe Sept. 14, 2021, 6:33 p.m. UTC | #1
On Thu, Sep 02, 2021 at 04:46:38PM +0800, Xiao Yang wrote:
> Make all is_user members of struct rxe_sq/rxe_cq/rxe_srq/rxe_cq
> has the same type.
> 
> Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
>  drivers/infiniband/sw/rxe/rxe_cq.c    | 3 +--
>  drivers/infiniband/sw/rxe/rxe_verbs.h | 2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_cq.c b/drivers/infiniband/sw/rxe/rxe_cq.c
> index aef288f164fd..fd655e41d621 100644
> +++ b/drivers/infiniband/sw/rxe/rxe_cq.c
> @@ -81,8 +81,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe,
>  		return err;
>  	}
>  
> -	if (uresp)
> -		cq->is_user = 1;
> +	cq->is_user = uresp ? true : false;

When you resend this series we don't need any of the ternary
expressions, when things implicitly cast to bool they are converted to
1/0 using the same logic as any other boolean expression. So just
write

cq->is_user = uresp;

Jason
Xiao Yang Sept. 16, 2021, 9:17 a.m. UTC | #2
On 2021/9/15 2:33, Jason Gunthorpe wrote:
> On Thu, Sep 02, 2021 at 04:46:38PM +0800, Xiao Yang wrote:
>> Make all is_user members of struct rxe_sq/rxe_cq/rxe_srq/rxe_cq
>> has the same type.
>>
>> Signed-off-by: Xiao Yang<yangx.jy@fujitsu.com>
>>   drivers/infiniband/sw/rxe/rxe_cq.c    | 3 +--
>>   drivers/infiniband/sw/rxe/rxe_verbs.h | 2 +-
>>   2 files changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/infiniband/sw/rxe/rxe_cq.c b/drivers/infiniband/sw/rxe/rxe_cq.c
>> index aef288f164fd..fd655e41d621 100644
>> +++ b/drivers/infiniband/sw/rxe/rxe_cq.c
>> @@ -81,8 +81,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe,
>>   		return err;
>>   	}
>>
>> -	if (uresp)
>> -		cq->is_user = 1;
>> +	cq->is_user = uresp ? true : false;
> When you resend this series we don't need any of the ternary
> expressions, when things implicitly cast to bool they are converted to
> 1/0 using the same logic as any other boolean expression. So just
> write
>
> cq->is_user = uresp;
Hi Jason,

Thanks for your suggestion.
I will update it in the next version.

Best Regards,
Xiao Yang
> Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_cq.c b/drivers/infiniband/sw/rxe/rxe_cq.c
index aef288f164fd..fd655e41d621 100644
--- a/drivers/infiniband/sw/rxe/rxe_cq.c
+++ b/drivers/infiniband/sw/rxe/rxe_cq.c
@@ -81,8 +81,7 @@  int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe,
 		return err;
 	}
 
-	if (uresp)
-		cq->is_user = 1;
+	cq->is_user = uresp ? true : false;
 
 	cq->is_dying = false;
 
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h
index bb5fb157d073..645eaea564ca 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.h
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.h
@@ -64,7 +64,7 @@  struct rxe_cq {
 	spinlock_t		cq_lock;
 	u8			notify;
 	bool			is_dying;
-	int			is_user;
+	bool			is_user;
 	struct tasklet_struct	comp_task;
 };