Skip to content

Commit 961cf99

Browse files
idoschdavem330
authored andcommitted
mlxsw: core: Re-order initialization sequence
The driver core first registers with the hwmon and thermal subsystems and only then proceeds to initialize the switch driver (e.g., mlxsw_spectrum). It is only during the last stage that the current firmware version is validated and a newer one flashed, if necessary. The above means that if a new firmware feature is utilized by the hwmon/thermal code, the driver will not be able to load. Solve this by re-ordering initializing the switch driver before registering with the hwmon and thermal subsystems. Signed-off-by: Ido Schimmel <[email protected]> Reported-by: Shalom Toledo <[email protected]> Acked-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3029a69 commit 961cf99

File tree

1 file changed

+11
-10
lines changed
  • drivers/net/ethernet/mellanox/mlxsw

1 file changed

+11
-10
lines changed

drivers/net/ethernet/mellanox/mlxsw/core.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,12 @@ __mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
10981098
goto err_register_params;
10991099
}
11001100

1101+
if (mlxsw_driver->init) {
1102+
err = mlxsw_driver->init(mlxsw_core, mlxsw_bus_info);
1103+
if (err)
1104+
goto err_driver_init;
1105+
}
1106+
11011107
err = mlxsw_hwmon_init(mlxsw_core, mlxsw_bus_info, &mlxsw_core->hwmon);
11021108
if (err)
11031109
goto err_hwmon_init;
@@ -1107,22 +1113,17 @@ __mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
11071113
if (err)
11081114
goto err_thermal_init;
11091115

1110-
if (mlxsw_driver->init) {
1111-
err = mlxsw_driver->init(mlxsw_core, mlxsw_bus_info);
1112-
if (err)
1113-
goto err_driver_init;
1114-
}
1115-
11161116
if (mlxsw_driver->params_register && !reload)
11171117
devlink_params_publish(devlink);
11181118

11191119
return 0;
11201120

1121-
err_driver_init:
1122-
mlxsw_thermal_fini(mlxsw_core->thermal);
11231121
err_thermal_init:
11241122
mlxsw_hwmon_fini(mlxsw_core->hwmon);
11251123
err_hwmon_init:
1124+
if (mlxsw_core->driver->fini)
1125+
mlxsw_core->driver->fini(mlxsw_core);
1126+
err_driver_init:
11261127
if (mlxsw_driver->params_unregister && !reload)
11271128
mlxsw_driver->params_unregister(mlxsw_core);
11281129
err_register_params:
@@ -1187,10 +1188,10 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core,
11871188

11881189
if (mlxsw_core->driver->params_unregister && !reload)
11891190
devlink_params_unpublish(devlink);
1190-
if (mlxsw_core->driver->fini)
1191-
mlxsw_core->driver->fini(mlxsw_core);
11921191
mlxsw_thermal_fini(mlxsw_core->thermal);
11931192
mlxsw_hwmon_fini(mlxsw_core->hwmon);
1193+
if (mlxsw_core->driver->fini)
1194+
mlxsw_core->driver->fini(mlxsw_core);
11941195
if (mlxsw_core->driver->params_unregister && !reload)
11951196
mlxsw_core->driver->params_unregister(mlxsw_core);
11961197
if (!reload)

0 commit comments

Comments
 (0)