Commit f999b706 authored by Parav Pandit's avatar Parav Pandit Committed by Saeed Mahameed

net/mlx5: Simplify mlx5_unload_one() and its callers

mlx5_unload_one() always returns 0.
Simplify callers of mlx5_unload_one() and remove the dead code.
Reviewed-by: default avatarMoshe Shemesh <moshe@mellanox.com>
Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent ecd01db8
...@@ -90,7 +90,8 @@ static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change, ...@@ -90,7 +90,8 @@ static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change,
{ {
struct mlx5_core_dev *dev = devlink_priv(devlink); struct mlx5_core_dev *dev = devlink_priv(devlink);
return mlx5_unload_one(dev, false); mlx5_unload_one(dev, false);
return 0;
} }
static int mlx5_devlink_reload_up(struct devlink *devlink, static int mlx5_devlink_reload_up(struct devlink *devlink,
......
...@@ -1235,7 +1235,7 @@ int mlx5_load_one(struct mlx5_core_dev *dev, bool boot) ...@@ -1235,7 +1235,7 @@ int mlx5_load_one(struct mlx5_core_dev *dev, bool boot)
return err; return err;
} }
int mlx5_unload_one(struct mlx5_core_dev *dev, bool cleanup) void mlx5_unload_one(struct mlx5_core_dev *dev, bool cleanup)
{ {
if (cleanup) { if (cleanup) {
mlx5_unregister_device(dev); mlx5_unregister_device(dev);
...@@ -1264,7 +1264,6 @@ int mlx5_unload_one(struct mlx5_core_dev *dev, bool cleanup) ...@@ -1264,7 +1264,6 @@ int mlx5_unload_one(struct mlx5_core_dev *dev, bool cleanup)
mlx5_function_teardown(dev, cleanup); mlx5_function_teardown(dev, cleanup);
out: out:
mutex_unlock(&dev->intf_state_mutex); mutex_unlock(&dev->intf_state_mutex);
return 0;
} }
static int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx) static int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx)
...@@ -1385,12 +1384,7 @@ static void remove_one(struct pci_dev *pdev) ...@@ -1385,12 +1384,7 @@ static void remove_one(struct pci_dev *pdev)
mlx5_crdump_disable(dev); mlx5_crdump_disable(dev);
mlx5_devlink_unregister(devlink); mlx5_devlink_unregister(devlink);
if (mlx5_unload_one(dev, true)) { mlx5_unload_one(dev, true);
mlx5_core_err(dev, "mlx5_unload_one failed\n");
mlx5_health_flush(dev);
return;
}
mlx5_pci_close(dev); mlx5_pci_close(dev);
mlx5_mdev_uninit(dev); mlx5_mdev_uninit(dev);
mlx5_devlink_free(devlink); mlx5_devlink_free(devlink);
......
...@@ -244,6 +244,6 @@ enum { ...@@ -244,6 +244,6 @@ enum {
u8 mlx5_get_nic_state(struct mlx5_core_dev *dev); u8 mlx5_get_nic_state(struct mlx5_core_dev *dev);
void mlx5_set_nic_state(struct mlx5_core_dev *dev, u8 state); void mlx5_set_nic_state(struct mlx5_core_dev *dev, u8 state);
int mlx5_unload_one(struct mlx5_core_dev *dev, bool cleanup); void mlx5_unload_one(struct mlx5_core_dev *dev, bool cleanup);
int mlx5_load_one(struct mlx5_core_dev *dev, bool boot); int mlx5_load_one(struct mlx5_core_dev *dev, bool boot);
#endif /* __MLX5_CORE_H__ */ #endif /* __MLX5_CORE_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment