Skip to content

Commit 7b261af

Browse files
vadimp-nvidiadavem330
authored andcommitted
mlxsw: core: Add bus argument to environment init API
Pass bus argument to mlxsw_env_init(). The purpose is to get access to device handle, which is to be provided to error message in case of line card activation failure. Signed-off-by: Vadim Pasternak <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent de28976 commit 7b261af

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2175,7 +2175,7 @@ __mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
21752175
if (err)
21762176
goto err_thermal_init;
21772177

2178-
err = mlxsw_env_init(mlxsw_core, &mlxsw_core->env);
2178+
err = mlxsw_env_init(mlxsw_core, mlxsw_bus_info, &mlxsw_core->env);
21792179
if (err)
21802180
goto err_env_init;
21812181

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct mlxsw_env_line_card {
2828

2929
struct mlxsw_env {
3030
struct mlxsw_core *core;
31+
const struct mlxsw_bus_info *bus_info;
3132
u8 max_module_count; /* Maximum number of modules per-slot. */
3233
u8 num_of_slots; /* Including the main board. */
3334
struct mutex line_cards_lock; /* Protects line cards. */
@@ -1194,7 +1195,9 @@ mlxsw_env_module_type_set(struct mlxsw_core *mlxsw_core, u8 slot_index)
11941195
return 0;
11951196
}
11961197

1197-
int mlxsw_env_init(struct mlxsw_core *mlxsw_core, struct mlxsw_env **p_env)
1198+
int mlxsw_env_init(struct mlxsw_core *mlxsw_core,
1199+
const struct mlxsw_bus_info *bus_info,
1200+
struct mlxsw_env **p_env)
11981201
{
11991202
u8 module_count, num_of_slots, max_module_count;
12001203
char mgpir_pl[MLXSW_REG_MGPIR_LEN];
@@ -1221,6 +1224,7 @@ int mlxsw_env_init(struct mlxsw_core *mlxsw_core, struct mlxsw_env **p_env)
12211224
return -ENOMEM;
12221225

12231226
env->core = mlxsw_core;
1227+
env->bus_info = bus_info;
12241228
env->num_of_slots = num_of_slots + 1;
12251229
env->max_module_count = max_module_count;
12261230
err = mlxsw_env_line_cards_alloc(env);

drivers/net/ethernet/mellanox/mlxsw/core_env.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ int mlxsw_env_module_port_up(struct mlxsw_core *mlxsw_core, u8 slot_index,
6060
void mlxsw_env_module_port_down(struct mlxsw_core *mlxsw_core, u8 slot_index,
6161
u8 module);
6262

63-
int mlxsw_env_init(struct mlxsw_core *core, struct mlxsw_env **p_env);
63+
int mlxsw_env_init(struct mlxsw_core *core,
64+
const struct mlxsw_bus_info *bus_info,
65+
struct mlxsw_env **p_env);
6466
void mlxsw_env_fini(struct mlxsw_env *env);
6567

6668
#endif

0 commit comments

Comments
 (0)