From: Jiri Pirko <jiri@xxxxxxxxxxxx> [ Upstream commit 73a533ecf0af5f73ff72dd7c96d1c8598ca93649 ] Call devlink enable only during probe time and avoid deadlock during reload. Reported-by: Shalom Toledo <shalomt@xxxxxxxxxxxx> Fixes: 5a508a254bed ("devlink: disallow reload operation during device cleanup") Signed-off-by: Jiri Pirko <jiri@xxxxxxxxxxxx> Tested-by: Shalom Toledo <shalomt@xxxxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/net/ethernet/mellanox/mlxsw/core.c | 5 +++-- net/core/devlink.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/mellanox/mlxsw/core.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c @@ -1128,10 +1128,11 @@ __mlxsw_core_bus_device_register(const s if (err) goto err_thermal_init; - if (mlxsw_driver->params_register) { + if (mlxsw_driver->params_register) devlink_params_publish(devlink); + + if (!reload) devlink_reload_enable(devlink); - } return 0; --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -5559,7 +5559,7 @@ EXPORT_SYMBOL_GPL(devlink_register); void devlink_unregister(struct devlink *devlink) { mutex_lock(&devlink_mutex); - WARN_ON(devlink_reload_supported(devlink) && + WARN_ON(devlink->ops->reload && devlink->reload_enabled); devlink_notify(devlink, DEVLINK_CMD_DEL); list_del(&devlink->list);