Commit 868bc06b authored by Saeed Mahameed's avatar Saeed Mahameed

net/mlx5: Remove redundant init functions parameter

This patch does not change any functionality.
Signed-off-by: default avatarVu Pham <vuhuong@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent bbf29f61
...@@ -729,8 +729,9 @@ static int mlx5_core_set_issi(struct mlx5_core_dev *dev) ...@@ -729,8 +729,9 @@ static int mlx5_core_set_issi(struct mlx5_core_dev *dev)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv) static int mlx5_pci_init(struct mlx5_core_dev *dev)
{ {
struct mlx5_priv *priv = &dev->priv;
struct pci_dev *pdev = dev->pdev; struct pci_dev *pdev = dev->pdev;
int err = 0; int err = 0;
...@@ -796,24 +797,24 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv) ...@@ -796,24 +797,24 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
return err; return err;
} }
static void mlx5_pci_close(struct mlx5_core_dev *dev, struct mlx5_priv *priv) static void mlx5_pci_close(struct mlx5_core_dev *dev)
{ {
iounmap(dev->iseg); iounmap(dev->iseg);
pci_clear_master(dev->pdev); pci_clear_master(dev->pdev);
release_bar(dev->pdev); release_bar(dev->pdev);
mlx5_pci_disable_device(dev); mlx5_pci_disable_device(dev);
debugfs_remove_recursive(priv->dbg_root); debugfs_remove_recursive(dev->priv.dbg_root);
} }
static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv) static int mlx5_init_once(struct mlx5_core_dev *dev)
{ {
struct pci_dev *pdev = dev->pdev; struct pci_dev *pdev = dev->pdev;
int err; int err;
priv->devcom = mlx5_devcom_register_device(dev); dev->priv.devcom = mlx5_devcom_register_device(dev);
if (IS_ERR(priv->devcom)) if (IS_ERR(dev->priv.devcom))
dev_err(&pdev->dev, "failed to register with devcom (0x%p)\n", dev_err(&pdev->dev, "failed to register with devcom (0x%p)\n",
priv->devcom); dev->priv.devcom);
err = mlx5_query_board_id(dev); err = mlx5_query_board_id(dev);
if (err) { if (err) {
...@@ -925,8 +926,7 @@ static void mlx5_cleanup_once(struct mlx5_core_dev *dev) ...@@ -925,8 +926,7 @@ static void mlx5_cleanup_once(struct mlx5_core_dev *dev)
mlx5_devcom_unregister_device(dev->priv.devcom); mlx5_devcom_unregister_device(dev->priv.devcom);
} }
static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, static int mlx5_load_one(struct mlx5_core_dev *dev, bool boot)
bool boot)
{ {
struct pci_dev *pdev = dev->pdev; struct pci_dev *pdev = dev->pdev;
int err; int err;
...@@ -1026,7 +1026,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, ...@@ -1026,7 +1026,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
} }
if (boot) { if (boot) {
err = mlx5_init_once(dev, priv); err = mlx5_init_once(dev);
if (err) { if (err) {
dev_err(&pdev->dev, "sw objs init failed\n"); dev_err(&pdev->dev, "sw objs init failed\n");
goto err_stop_poll; goto err_stop_poll;
...@@ -1140,7 +1140,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, ...@@ -1140,7 +1140,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
err_eq_table: err_eq_table:
mlx5_pagealloc_stop(dev); mlx5_pagealloc_stop(dev);
mlx5_events_stop(dev); mlx5_events_stop(dev);
mlx5_put_uars_page(dev, priv->uar); mlx5_put_uars_page(dev, dev->priv.uar);
err_get_uars: err_get_uars:
if (boot) if (boot)
...@@ -1169,8 +1169,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, ...@@ -1169,8 +1169,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
return err; return err;
} }
static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, static int mlx5_unload_one(struct mlx5_core_dev *dev, bool cleanup)
bool cleanup)
{ {
int err = 0; int err = 0;
...@@ -1201,7 +1200,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, ...@@ -1201,7 +1200,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
mlx5_eq_table_destroy(dev); mlx5_eq_table_destroy(dev);
mlx5_pagealloc_stop(dev); mlx5_pagealloc_stop(dev);
mlx5_events_stop(dev); mlx5_events_stop(dev);
mlx5_put_uars_page(dev, priv->uar); mlx5_put_uars_page(dev, dev->priv.uar);
if (cleanup) if (cleanup)
mlx5_cleanup_once(dev); mlx5_cleanup_once(dev);
mlx5_stop_health_poll(dev, cleanup); mlx5_stop_health_poll(dev, cleanup);
...@@ -1265,7 +1264,7 @@ static int init_one(struct pci_dev *pdev, ...@@ -1265,7 +1264,7 @@ static int init_one(struct pci_dev *pdev,
INIT_LIST_HEAD(&priv->bfregs.reg_head.list); INIT_LIST_HEAD(&priv->bfregs.reg_head.list);
INIT_LIST_HEAD(&priv->bfregs.wc_head.list); INIT_LIST_HEAD(&priv->bfregs.wc_head.list);
err = mlx5_pci_init(dev, priv); err = mlx5_pci_init(dev);
if (err) { if (err) {
dev_err(&pdev->dev, "mlx5_pci_init failed with error code %d\n", err); dev_err(&pdev->dev, "mlx5_pci_init failed with error code %d\n", err);
goto clean_dev; goto clean_dev;
...@@ -1281,7 +1280,7 @@ static int init_one(struct pci_dev *pdev, ...@@ -1281,7 +1280,7 @@ static int init_one(struct pci_dev *pdev,
if (err) if (err)
goto err_pagealloc_init; goto err_pagealloc_init;
err = mlx5_load_one(dev, priv, true); err = mlx5_load_one(dev, true);
if (err) { if (err) {
dev_err(&pdev->dev, "mlx5_load_one failed with error code %d\n", err); dev_err(&pdev->dev, "mlx5_load_one failed with error code %d\n", err);
goto err_load_one; goto err_load_one;
...@@ -1297,13 +1296,13 @@ static int init_one(struct pci_dev *pdev, ...@@ -1297,13 +1296,13 @@ static int init_one(struct pci_dev *pdev,
return 0; return 0;
clean_load: clean_load:
mlx5_unload_one(dev, priv, true); mlx5_unload_one(dev, true);
err_load_one: err_load_one:
mlx5_pagealloc_cleanup(dev); mlx5_pagealloc_cleanup(dev);
err_pagealloc_init: err_pagealloc_init:
mlx5_health_cleanup(dev); mlx5_health_cleanup(dev);
close_pci: close_pci:
mlx5_pci_close(dev, priv); mlx5_pci_close(dev);
clean_dev: clean_dev:
devlink_free(devlink); devlink_free(devlink);
...@@ -1314,12 +1313,11 @@ static void remove_one(struct pci_dev *pdev) ...@@ -1314,12 +1313,11 @@ static void remove_one(struct pci_dev *pdev)
{ {
struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
struct devlink *devlink = priv_to_devlink(dev); struct devlink *devlink = priv_to_devlink(dev);
struct mlx5_priv *priv = &dev->priv;
devlink_unregister(devlink); devlink_unregister(devlink);
mlx5_unregister_device(dev); mlx5_unregister_device(dev);
if (mlx5_unload_one(dev, priv, true)) { if (mlx5_unload_one(dev, true)) {
dev_err(&dev->pdev->dev, "mlx5_unload_one failed\n"); dev_err(&dev->pdev->dev, "mlx5_unload_one failed\n");
mlx5_health_cleanup(dev); mlx5_health_cleanup(dev);
return; return;
...@@ -1327,7 +1325,7 @@ static void remove_one(struct pci_dev *pdev) ...@@ -1327,7 +1325,7 @@ static void remove_one(struct pci_dev *pdev)
mlx5_pagealloc_cleanup(dev); mlx5_pagealloc_cleanup(dev);
mlx5_health_cleanup(dev); mlx5_health_cleanup(dev);
mlx5_pci_close(dev, priv); mlx5_pci_close(dev);
devlink_free(devlink); devlink_free(devlink);
} }
...@@ -1335,12 +1333,11 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev, ...@@ -1335,12 +1333,11 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
pci_channel_state_t state) pci_channel_state_t state)
{ {
struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
struct mlx5_priv *priv = &dev->priv;
dev_info(&pdev->dev, "%s was called\n", __func__); dev_info(&pdev->dev, "%s was called\n", __func__);
mlx5_enter_error_state(dev, false); mlx5_enter_error_state(dev, false);
mlx5_unload_one(dev, priv, false); mlx5_unload_one(dev, false);
/* In case of kernel call drain the health wq */ /* In case of kernel call drain the health wq */
if (state) { if (state) {
mlx5_drain_health_wq(dev); mlx5_drain_health_wq(dev);
...@@ -1407,12 +1404,11 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev) ...@@ -1407,12 +1404,11 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev)
static void mlx5_pci_resume(struct pci_dev *pdev) static void mlx5_pci_resume(struct pci_dev *pdev)
{ {
struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
struct mlx5_priv *priv = &dev->priv;
int err; int err;
dev_info(&pdev->dev, "%s was called\n", __func__); dev_info(&pdev->dev, "%s was called\n", __func__);
err = mlx5_load_one(dev, priv, false); err = mlx5_load_one(dev, false);
if (err) if (err)
dev_err(&pdev->dev, "%s: mlx5_load_one failed with error code: %d\n" dev_err(&pdev->dev, "%s: mlx5_load_one failed with error code: %d\n"
, __func__, err); , __func__, err);
...@@ -1479,13 +1475,12 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev *dev) ...@@ -1479,13 +1475,12 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev *dev)
static void shutdown(struct pci_dev *pdev) static void shutdown(struct pci_dev *pdev)
{ {
struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
struct mlx5_priv *priv = &dev->priv;
int err; int err;
dev_info(&pdev->dev, "Shutdown was called\n"); dev_info(&pdev->dev, "Shutdown was called\n");
err = mlx5_try_fast_unload(dev); err = mlx5_try_fast_unload(dev);
if (err) if (err)
mlx5_unload_one(dev, priv, false); mlx5_unload_one(dev, false);
mlx5_pci_disable_device(dev); mlx5_pci_disable_device(dev);
} }
......
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