linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Saleem, Shiraz" <shiraz.saleem@intel.com>
To: Yejune Deng <yejune.deng@gmail.com>,
	"Latif, Faisal" <faisal.latif@intel.com>,
	"dledford@redhat.com" <dledford@redhat.com>,
	"jgg@ziepe.ca" <jgg@ziepe.ca>
Cc: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] infiniband: i40iw: replace atomic_add_return()
Date: Tue, 1 Dec 2020 14:42:25 +0000	[thread overview]
Message-ID: <b578b692d2ec4f598be584b809aed400@intel.com> (raw)
In-Reply-To: <1606726376-7675-1-git-send-email-yejune.deng@gmail.com>

> 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?

  reply	other threads:[~2020-12-01 14:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30  8:52 [PATCH] infiniband: i40iw: replace atomic_add_return() Yejune Deng
2020-12-01 14:42 ` Saleem, Shiraz [this message]
2020-12-01 16:14   ` Jason Gunthorpe
2020-12-07 19:41 ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b578b692d2ec4f598be584b809aed400@intel.com \
    --to=shiraz.saleem@intel.com \
    --cc=dledford@redhat.com \
    --cc=faisal.latif@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=yejune.deng@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).