* [PATCH] sfc: Use swap() instead of open coding it
@ 2022-01-05 15:22 Jiapeng Chong
2022-01-06 9:02 ` Martin Habets
2022-01-06 12:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Jiapeng Chong @ 2022-01-05 15:22 UTC (permalink / raw)
To: ecree.xilinx
Cc: habetsm.xilinx, davem, kuba, ast, daniel, hawk, john.fastabend,
netdev, linux-kernel, bpf, Jiapeng Chong, Abaci Robot
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>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sfc: Use swap() instead of open coding it
2022-01-05 15:22 [PATCH] sfc: Use swap() instead of open coding it Jiapeng Chong
@ 2022-01-06 9:02 ` Martin Habets
2022-01-06 12:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Martin Habets @ 2022-01-06 9:02 UTC (permalink / raw)
To: Jiapeng Chong
Cc: ecree.xilinx, davem, kuba, ast, daniel, hawk, john.fastabend,
netdev, linux-kernel, bpf, Abaci Robot
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sfc: Use swap() instead of open coding it
2022-01-05 15:22 [PATCH] sfc: Use swap() instead of open coding it Jiapeng Chong
2022-01-06 9:02 ` Martin Habets
@ 2022-01-06 12:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-06 12:50 UTC (permalink / raw)
To: Jiapeng Chong
Cc: ecree.xilinx, habetsm.xilinx, davem, kuba, ast, daniel, hawk,
john.fastabend, netdev, linux-kernel, bpf, abaci
Hello:
This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:
On Wed, 5 Jan 2022 23:22:37 +0800 you 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().
>
> [...]
Here is the summary with links:
- sfc: Use swap() instead of open coding it
https://git.kernel.org/netdev/net-next/c/0cf765fb00ce
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-06 12:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 15:22 [PATCH] sfc: Use swap() instead of open coding it Jiapeng Chong
2022-01-06 9:02 ` Martin Habets
2022-01-06 12:50 ` patchwork-bot+netdevbpf
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).