net: ethernet: Use swap() instead of open coding it
Subsystems (3)
PATCH v2 1/1 net: ethernet: Use swap() instead of open coding it
Clean the following coccicheck warning:
./drivers/net/ethernet/sunplus/spl2sw_driver.c:217:27-28: WARNING opportunity for swap().
./drivers/net/ethernet/sunplus/spl2sw_driver.c:222:27-28: WARNING opportunity for swap().
---
Changes in v2:
-Delete useless comments.
drivers/net/ethernet/sunplus/spl2sw_driver.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
drivers/net/ethernet/sunplus/spl2sw_driver.c +4 -16
@@ -204,28 +204,16 @@ static const struct net_device_ops netdev_ops = {static void spl2sw_check_mac_vendor_id_and_convert (u8 *mac_addr) { -u8 tmp; -/* Byte order of MAC address of some samples are reversed. * Check vendor id and convert byte order if it is wrong. * OUI of Sunplus: fc:4b:bc */ if (mac_addr[5 ] ==0xfc && mac_addr[4 ] ==0x4b && mac_addr[3 ] ==0xbc && (mac_addr[0 ] !=0xfc || mac_addr[1 ] !=0x4b || mac_addr[2 ] !=0xbc )) { -/* Swap mac_addr[0] and mac_addr[5] */ - tmp = mac_addr[0 ]; - mac_addr[0 ] = mac_addr[5 ]; - mac_addr[5 ] = tmp; - -/* Swap mac_addr[1] and mac_addr[4] */ - tmp = mac_addr[1 ]; - mac_addr[1 ] = mac_addr[4 ]; - mac_addr[4 ] = tmp; - -/* Swap mac_addr[2] and mac_addr[3] */ - tmp = mac_addr[2 ]; - mac_addr[2 ] = mac_addr[3 ]; - mac_addr[3 ] = tmp; + +swap (mac_addr[0 ], mac_addr[5 ]); +swap (mac_addr[1 ], mac_addr[4 ]); +swap (mac_addr[2 ], mac_addr[3 ]); } }
Signature · 1 line
2.20.1.7.g153144c
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 9 lines · On Thu, 12 May 2022 14:09:05 +0800 you wrote:
Clean the following coccicheck warning:
./drivers/net/ethernet/sunplus/spl2sw_driver.c:217:27-28: WARNING opportunity for
swap()../drivers/net/ethernet/sunplus/spl2sw_driver.c:222:27-28: WARNING opportunity for
swap().[...]
Here is the summary with links:
- [v2] net: ethernet: Use swap() instead of open coding it
https://git.kernel.org/netdev/net-next/c/a19cef450bb6
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html