Commit 1d264db4 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by David S. Miller

octeontx2: Move devlink registration to be last devlink command

This change prevents from users to access device before devlink is fully
configured. This change allows us to delete call to devlink_params_publish()
and impossible check during unregister flow.
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 838cefd5
...@@ -1510,7 +1510,6 @@ int rvu_register_dl(struct rvu *rvu) ...@@ -1510,7 +1510,6 @@ int rvu_register_dl(struct rvu *rvu)
return -ENOMEM; return -ENOMEM;
} }
devlink_register(dl);
rvu_dl = devlink_priv(dl); rvu_dl = devlink_priv(dl);
rvu_dl->dl = dl; rvu_dl->dl = dl;
rvu_dl->rvu = rvu; rvu_dl->rvu = rvu;
...@@ -1531,13 +1530,11 @@ int rvu_register_dl(struct rvu *rvu) ...@@ -1531,13 +1530,11 @@ int rvu_register_dl(struct rvu *rvu)
goto err_dl_health; goto err_dl_health;
} }
devlink_params_publish(dl); devlink_register(dl);
return 0; return 0;
err_dl_health: err_dl_health:
rvu_health_reporters_destroy(rvu); rvu_health_reporters_destroy(rvu);
devlink_unregister(dl);
devlink_free(dl); devlink_free(dl);
return err; return err;
} }
...@@ -1547,12 +1544,9 @@ void rvu_unregister_dl(struct rvu *rvu) ...@@ -1547,12 +1544,9 @@ void rvu_unregister_dl(struct rvu *rvu)
struct rvu_devlink *rvu_dl = rvu->rvu_dl; struct rvu_devlink *rvu_dl = rvu->rvu_dl;
struct devlink *dl = rvu_dl->dl; struct devlink *dl = rvu_dl->dl;
if (!dl) devlink_unregister(dl);
return;
devlink_params_unregister(dl, rvu_af_dl_params, devlink_params_unregister(dl, rvu_af_dl_params,
ARRAY_SIZE(rvu_af_dl_params)); ARRAY_SIZE(rvu_af_dl_params));
rvu_health_reporters_destroy(rvu); rvu_health_reporters_destroy(rvu);
devlink_unregister(dl);
devlink_free(dl); devlink_free(dl);
} }
...@@ -108,7 +108,6 @@ int otx2_register_dl(struct otx2_nic *pfvf) ...@@ -108,7 +108,6 @@ int otx2_register_dl(struct otx2_nic *pfvf)
return -ENOMEM; return -ENOMEM;
} }
devlink_register(dl);
otx2_dl = devlink_priv(dl); otx2_dl = devlink_priv(dl);
otx2_dl->dl = dl; otx2_dl->dl = dl;
otx2_dl->pfvf = pfvf; otx2_dl->pfvf = pfvf;
...@@ -122,12 +121,10 @@ int otx2_register_dl(struct otx2_nic *pfvf) ...@@ -122,12 +121,10 @@ int otx2_register_dl(struct otx2_nic *pfvf)
goto err_dl; goto err_dl;
} }
devlink_params_publish(dl); devlink_register(dl);
return 0; return 0;
err_dl: err_dl:
devlink_unregister(dl);
devlink_free(dl); devlink_free(dl);
return err; return err;
} }
...@@ -135,16 +132,10 @@ int otx2_register_dl(struct otx2_nic *pfvf) ...@@ -135,16 +132,10 @@ int otx2_register_dl(struct otx2_nic *pfvf)
void otx2_unregister_dl(struct otx2_nic *pfvf) void otx2_unregister_dl(struct otx2_nic *pfvf)
{ {
struct otx2_devlink *otx2_dl = pfvf->dl; struct otx2_devlink *otx2_dl = pfvf->dl;
struct devlink *dl; struct devlink *dl = otx2_dl->dl;
if (!otx2_dl || !otx2_dl->dl)
return;
dl = otx2_dl->dl;
devlink_unregister(dl);
devlink_params_unregister(dl, otx2_dl_params, devlink_params_unregister(dl, otx2_dl_params,
ARRAY_SIZE(otx2_dl_params)); ARRAY_SIZE(otx2_dl_params));
devlink_unregister(dl);
devlink_free(dl); devlink_free(dl);
} }
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