netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Habets <habetsm.xilinx@gmail.com>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: ecree.xilinx@gmail.com, davem@davemloft.net, kuba@kernel.org,
	ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org,
	john.fastabend@gmail.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
	Abaci Robot <abaci@linux.alibaba.com>
Subject: Re: [PATCH] sfc: Use swap() instead of open coding it
Date: Thu, 6 Jan 2022 09:02:21 +0000	[thread overview]
Message-ID: <20220106090221.4gj6cevh2sb7hrfb@gmail.com> (raw)
In-Reply-To: <20220105152237.45991-1-jiapeng.chong@linux.alibaba.com>

On Wed, Jan 05, 2022 at 11:22:37PM +0800, Jiapeng Chong wrote:
> Clean the following coccicheck warning:
> 
> ./drivers/net/ethernet/sfc/efx_channels.c:870:36-37: WARNING opportunity
> for swap().
> 
> ./drivers/net/ethernet/sfc/efx_channels.c:824:36-37: WARNING opportunity
> for swap().
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

Acked-by: Martin Habets <habetsm.xilinx@gmail.com>

> ---
>  drivers/net/ethernet/sfc/efx_channels.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet/sfc/efx_channels.c
> index b015d1f2e204..ead550ae2709 100644
> --- a/drivers/net/ethernet/sfc/efx_channels.c
> +++ b/drivers/net/ethernet/sfc/efx_channels.c
> @@ -819,11 +819,8 @@ int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries)
>  	old_txq_entries = efx->txq_entries;
>  	efx->rxq_entries = rxq_entries;
>  	efx->txq_entries = txq_entries;
> -	for (i = 0; i < efx->n_channels; i++) {
> -		channel = efx->channel[i];
> -		efx->channel[i] = other_channel[i];
> -		other_channel[i] = channel;
> -	}
> +	for (i = 0; i < efx->n_channels; i++)
> +		swap(efx->channel[i], other_channel[i]);
>  
>  	/* Restart buffer table allocation */
>  	efx->next_buffer_table = next_buffer_table;
> @@ -865,11 +862,8 @@ int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries)
>  	/* Swap back */
>  	efx->rxq_entries = old_rxq_entries;
>  	efx->txq_entries = old_txq_entries;
> -	for (i = 0; i < efx->n_channels; i++) {
> -		channel = efx->channel[i];
> -		efx->channel[i] = other_channel[i];
> -		other_channel[i] = channel;
> -	}
> +	for (i = 0; i < efx->n_channels; i++)
> +		swap(efx->channel[i], other_channel[i]);
>  	goto out;
>  }
>  
> -- 
> 2.20.1.7.g153144c

  reply	other threads:[~2022-01-06  9:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 15:22 [PATCH] sfc: Use swap() instead of open coding it Jiapeng Chong
2022-01-06  9:02 ` Martin Habets [this message]
2022-01-06 12:50 ` patchwork-bot+netdevbpf

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=20220106090221.4gj6cevh2sb7hrfb@gmail.com \
    --to=habetsm.xilinx@gmail.com \
    --cc=abaci@linux.alibaba.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=hawk@kernel.org \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).