@@ -793,11 +793,14 @@ int mlx5_devlink_register(struct devlink
{
int err;
- err = devlink_params_register(devlink, mlx5_devlink_params,
- ARRAY_SIZE(mlx5_devlink_params));
+ err = devlink_register(devlink);
if (err)
return err;
+ err = devlink_params_register(devlink, mlx5_devlink_params,
+ ARRAY_SIZE(mlx5_devlink_params));
+ if (err)
+ goto params_reg_err;
mlx5_devlink_set_params_init_values(devlink);
err = mlx5_devlink_auxdev_params_register(devlink);
@@ -808,6 +811,7 @@ int mlx5_devlink_register(struct devlink
if (err)
goto traps_reg_err;
+ devlink_params_publish(devlink);
return 0;
traps_reg_err:
@@ -815,13 +819,17 @@ traps_reg_err:
auxdev_reg_err:
devlink_params_unregister(devlink, mlx5_devlink_params,
ARRAY_SIZE(mlx5_devlink_params));
+params_reg_err:
+ devlink_unregister(devlink);
return err;
}
void mlx5_devlink_unregister(struct devlink *devlink)
{
+ devlink_params_unpublish(devlink);
mlx5_devlink_traps_unregister(devlink);
mlx5_devlink_auxdev_params_unregister(devlink);
devlink_params_unregister(devlink, mlx5_devlink_params,
ARRAY_SIZE(mlx5_devlink_params));
+ devlink_unregister(devlink);
}
@@ -1541,7 +1541,6 @@ static int probe_one(struct pci_dev *pde
dev_err(&pdev->dev, "mlx5_crdump_enable failed with error code %d\n", err);
pci_save_state(pdev);
- devlink_register(devlink);
if (!mlx5_core_is_mp_slave(dev))
devlink_reload_enable(devlink);
return 0;
@@ -1564,7 +1563,6 @@ static void remove_one(struct pci_dev *p
struct devlink *devlink = priv_to_devlink(dev);
devlink_reload_disable(devlink);
- devlink_unregister(devlink);
mlx5_crdump_disable(dev);
mlx5_drain_health_wq(dev);
mlx5_uninit_one(dev);
@@ -46,7 +46,6 @@ static int mlx5_sf_dev_probe(struct auxi
mlx5_core_warn(mdev, "mlx5_init_one err=%d\n", err);
goto init_one_err;
}
- devlink_register(devlink);
devlink_reload_enable(devlink);
return 0;
@@ -66,7 +65,6 @@ static void mlx5_sf_dev_remove(struct au
devlink = priv_to_devlink(sf_dev->mdev);
devlink_reload_disable(devlink);
- devlink_unregister(devlink);
mlx5_uninit_one(sf_dev->mdev);
iounmap(sf_dev->mdev->iseg);
mlx5_mdev_uninit(sf_dev->mdev);