diff mbox series

[net-next,2/4] mlx4: replace mlx4_u64_to_mac() with u64_to_ether_addr()

Message ID 20211004191446.2127522-3-kuba@kernel.org (mailing list archive)
State Not Applicable
Headers show
Series mlx4: prep for constant dev->dev_addr | expand

Commit Message

Jakub Kicinski Oct. 4, 2021, 7:14 p.m. UTC
mlx4_u64_to_mac() predates the common helper but doesn't
make the argument constant.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/ethernet/mellanox/mlx4/cmd.c |  2 +-
 include/linux/mlx4/driver.h              | 10 ----------
 2 files changed, 1 insertion(+), 11 deletions(-)

Comments

Tariq Toukan Oct. 5, 2021, 9:59 a.m. UTC | #1
On 10/4/2021 10:14 PM, Jakub Kicinski wrote:
> mlx4_u64_to_mac() predates the common helper but doesn't
> make the argument constant.
> 

Neither does the argument constant.

> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>   drivers/net/ethernet/mellanox/mlx4/cmd.c |  2 +-
>   include/linux/mlx4/driver.h              | 10 ----------
>   2 files changed, 1 insertion(+), 11 deletions(-)
> 

Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 9fadedfca41c..94ead263081f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -3195,7 +3195,7 @@  int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting)
 	port = mlx4_slaves_closest_port(dev, slave, port);
 	s_info = &priv->mfunc.master.vf_admin[slave].vport[port];
 
-	mlx4_u64_to_mac(mac, s_info->mac);
+	u64_to_ether_addr(s_info->mac, mac);
 	if (setting && !is_valid_ether_addr(mac)) {
 		mlx4_info(dev, "Illegal MAC with spoofchk\n");
 		return -EPERM;
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index b26b71f62fb4..1834c8fad12e 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -92,14 +92,4 @@  void *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int
 
 struct devlink_port *mlx4_get_devlink_port(struct mlx4_dev *dev, int port);
 
-static inline void mlx4_u64_to_mac(u8 *addr, u64 mac)
-{
-	int i;
-
-	for (i = ETH_ALEN; i > 0; i--) {
-		addr[i - 1] = mac & 0xFF;
-		mac >>= 8;
-	}
-}
-
 #endif /* MLX4_DRIVER_H */