LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Martin Habets <habetsm.xilinx@gmail.com>
To: davidcomponentone@gmail.com
Cc: ecree.xilinx@gmail.com, davem@davemloft.net, kuba@kernel.org,
	hkallweit1@gmail.com, bhelgaas@google.com, yuehaibing@huawei.com,
	arnd@arndb.de, yang.guang5@zte.com.cn, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] sfc: use swap() to make code cleaner
Date: Mon, 8 Nov 2021 11:05:09 +0000	[thread overview]
Message-ID: <20211108110509.yjn4o22en2w22uwp@gmail.com> (raw)
In-Reply-To: <20211104065350.1834911-1-yang.guang5@zte.com.cn>

On Thu, Nov 04, 2021 at 02:53:50PM +0800, davidcomponentone@gmail.com wrote:
> From: Yang Guang <yang.guang5@zte.com.cn>
> 
> Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> opencoding it.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
> ---
>  drivers/net/ethernet/sfc/falcon/efx.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c
> index c68837a951f4..314c9c69eb0e 100644
> --- a/drivers/net/ethernet/sfc/falcon/efx.c
> +++ b/drivers/net/ethernet/sfc/falcon/efx.c
> @@ -817,9 +817,7 @@ ef4_realloc_channels(struct ef4_nic *efx, u32 rxq_entries, u32 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;
> +		swap(efx->channel[i], other_channel[i]);
>  	}

The braces are no longer needed. Remove those.

Martin

>  
>  	/* Restart buffer table allocation */
> @@ -863,9 +861,7 @@ ef4_realloc_channels(struct ef4_nic *efx, u32 rxq_entries, u32 txq_entries)
>  	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;
> +		swap(efx->channel[i], other_channel[i]);
>  	}
>  	goto out;
>  }
> -- 
> 2.30.2

      reply	other threads:[~2021-11-08 11:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04  6:53 davidcomponentone
2021-11-08 11:05 ` Martin Habets [this message]

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=20211108110509.yjn4o22en2w22uwp@gmail.com \
    --to=habetsm.xilinx@gmail.com \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=davem@davemloft.net \
    --cc=davidcomponentone@gmail.com \
    --cc=ecree.xilinx@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yang.guang5@zte.com.cn \
    --cc=yuehaibing@huawei.com \
    --cc=zealci@zte.com.cn \
    --subject='Re: [PATCH] sfc: use swap() to make code cleaner' \
    /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

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).