lkml.org 
[lkml]   [2020]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] infiniband: i40iw: replace atomic_add_return()
Date
> Subject: [PATCH] infiniband: i40iw: replace atomic_add_return()
>
> atomic_inc_return() is a little neater
>
> Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
> ---
> drivers/infiniband/hw/i40iw/i40iw_cm.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c
> b/drivers/infiniband/hw/i40iw/i40iw_cm.c
> index 3053c345..26e92ae 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_cm.c
> +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c
> @@ -2426,7 +2426,7 @@ static void i40iw_handle_rst_pkt(struct i40iw_cm_node
> *cm_node,
> }
> break;
> case I40IW_CM_STATE_MPAREQ_RCVD:
> - atomic_add_return(1, &cm_node->passive_state);
> + atomic_inc_return(&cm_node->passive_state);

Just an atomic_inc would suffice here.

> break;
> case I40IW_CM_STATE_ESTABLISHED:
> case I40IW_CM_STATE_SYN_RCVD:
> @@ -3020,7 +3020,7 @@ static int i40iw_cm_reject(struct i40iw_cm_node
> *cm_node, const void *pdata, u8
> i40iw_cleanup_retrans_entry(cm_node);
>
> if (!loopback) {
> - passive_state = atomic_add_return(1, &cm_node->passive_state);
> + passive_state = atomic_inc_return(&cm_node->passive_state);

Fine with it as its consistent across i40iw. But aren't there many more instances of this across the tree?
Isn't this a choice best left to the developer?

\
 
 \ /
  Last update: 2020-12-01 15:44    [W:0.068 / U:1.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site