Skip to content
/ linux Public

Commit 25a91f8

Browse files
idoschdavem330
authored andcommitted
mlxsw: core: Remove mlxsw_core_is_initialized()
After the previous patch, the switch driver is always initialized last, making this function redundant. Remove it. Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3d7a6f6 commit 25a91f8

File tree

3 files changed

+0
-15
lines changed

3 files changed

+0
-15
lines changed

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ struct mlxsw_core {
9090
struct devlink_health_reporter *fw_fatal;
9191
} health;
9292
struct mlxsw_env *env;
93-
bool is_initialized; /* Denotes if core was already initialized. */
9493
unsigned long driver_priv[];
9594
/* driver_priv has to be always the last item */
9695
};
@@ -2014,7 +2013,6 @@ __mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
20142013
goto err_driver_init;
20152014
}
20162015

2017-
mlxsw_core->is_initialized = true;
20182016
devlink_params_publish(devlink);
20192017

20202018
if (!reload)
@@ -2099,7 +2097,6 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core,
20992097
}
21002098

21012099
devlink_params_unpublish(devlink);
2102-
mlxsw_core->is_initialized = false;
21032100
if (mlxsw_core->driver->fini)
21042101
mlxsw_core->driver->fini(mlxsw_core);
21052102
mlxsw_env_fini(mlxsw_core->env);
@@ -2938,11 +2935,6 @@ struct mlxsw_env *mlxsw_core_env(const struct mlxsw_core *mlxsw_core)
29382935
return mlxsw_core->env;
29392936
}
29402937

2941-
bool mlxsw_core_is_initialized(const struct mlxsw_core *mlxsw_core)
2942-
{
2943-
return mlxsw_core->is_initialized;
2944-
}
2945-
29462938
static void mlxsw_core_buf_dump_dbg(struct mlxsw_core *mlxsw_core,
29472939
const char *buf, size_t size)
29482940
{

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ mlxsw_core_port_devlink_port_get(struct mlxsw_core *mlxsw_core,
249249
u8 local_port);
250250
bool mlxsw_core_port_is_xm(const struct mlxsw_core *mlxsw_core, u8 local_port);
251251
struct mlxsw_env *mlxsw_core_env(const struct mlxsw_core *mlxsw_core);
252-
bool mlxsw_core_is_initialized(const struct mlxsw_core *mlxsw_core);
253252

254253
int mlxsw_core_schedule_dw(struct delayed_work *dwork, unsigned long delay);
255254
bool mlxsw_core_schedule_work(struct work_struct *work);

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -667,12 +667,6 @@ mlxsw_env_module_overheat_counter_get(struct mlxsw_core *mlxsw_core, u8 module,
667667
{
668668
struct mlxsw_env *mlxsw_env = mlxsw_core_env(mlxsw_core);
669669

670-
/* Prevent switch driver from accessing uninitialized data. */
671-
if (!mlxsw_core_is_initialized(mlxsw_core)) {
672-
*p_counter = 0;
673-
return 0;
674-
}
675-
676670
if (WARN_ON_ONCE(module >= mlxsw_env->module_count))
677671
return -EINVAL;
678672

0 commit comments

Comments
 (0)