Commit fd70f044 authored by David S. Miller's avatar David S. Miller

Merge branch 'devlink-const'

Christophe JAILLET says:

====================
devlink: Constify struct devlink_dpipe_table_ops

Patch 1 updates devl_dpipe_table_register() and struct
devlink_dpipe_table to accept "const struct devlink_dpipe_table_ops".

Then patch 2 updates the only user of this function.

This is compile tested only.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 61578f67 b072aa78
...@@ -283,7 +283,7 @@ static u64 mlxsw_sp_dpipe_table_erif_size_get(void *priv) ...@@ -283,7 +283,7 @@ static u64 mlxsw_sp_dpipe_table_erif_size_get(void *priv)
return MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); return MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS);
} }
static struct devlink_dpipe_table_ops mlxsw_sp_erif_ops = { static const struct devlink_dpipe_table_ops mlxsw_sp_erif_ops = {
.matches_dump = mlxsw_sp_dpipe_table_erif_matches_dump, .matches_dump = mlxsw_sp_dpipe_table_erif_matches_dump,
.actions_dump = mlxsw_sp_dpipe_table_erif_actions_dump, .actions_dump = mlxsw_sp_dpipe_table_erif_actions_dump,
.entries_dump = mlxsw_sp_dpipe_table_erif_entries_dump, .entries_dump = mlxsw_sp_dpipe_table_erif_entries_dump,
...@@ -734,7 +734,7 @@ static u64 mlxsw_sp_dpipe_table_host4_size_get(void *priv) ...@@ -734,7 +734,7 @@ static u64 mlxsw_sp_dpipe_table_host4_size_get(void *priv)
return mlxsw_sp_dpipe_table_host_size_get(mlxsw_sp, AF_INET); return mlxsw_sp_dpipe_table_host_size_get(mlxsw_sp, AF_INET);
} }
static struct devlink_dpipe_table_ops mlxsw_sp_host4_ops = { static const struct devlink_dpipe_table_ops mlxsw_sp_host4_ops = {
.matches_dump = mlxsw_sp_dpipe_table_host4_matches_dump, .matches_dump = mlxsw_sp_dpipe_table_host4_matches_dump,
.actions_dump = mlxsw_sp_dpipe_table_host_actions_dump, .actions_dump = mlxsw_sp_dpipe_table_host_actions_dump,
.entries_dump = mlxsw_sp_dpipe_table_host4_entries_dump, .entries_dump = mlxsw_sp_dpipe_table_host4_entries_dump,
...@@ -811,7 +811,7 @@ static u64 mlxsw_sp_dpipe_table_host6_size_get(void *priv) ...@@ -811,7 +811,7 @@ static u64 mlxsw_sp_dpipe_table_host6_size_get(void *priv)
return mlxsw_sp_dpipe_table_host_size_get(mlxsw_sp, AF_INET6); return mlxsw_sp_dpipe_table_host_size_get(mlxsw_sp, AF_INET6);
} }
static struct devlink_dpipe_table_ops mlxsw_sp_host6_ops = { static const struct devlink_dpipe_table_ops mlxsw_sp_host6_ops = {
.matches_dump = mlxsw_sp_dpipe_table_host6_matches_dump, .matches_dump = mlxsw_sp_dpipe_table_host6_matches_dump,
.actions_dump = mlxsw_sp_dpipe_table_host_actions_dump, .actions_dump = mlxsw_sp_dpipe_table_host_actions_dump,
.entries_dump = mlxsw_sp_dpipe_table_host6_entries_dump, .entries_dump = mlxsw_sp_dpipe_table_host6_entries_dump,
...@@ -1230,7 +1230,7 @@ mlxsw_sp_dpipe_table_adj_size_get(void *priv) ...@@ -1230,7 +1230,7 @@ mlxsw_sp_dpipe_table_adj_size_get(void *priv)
return size; return size;
} }
static struct devlink_dpipe_table_ops mlxsw_sp_dpipe_table_adj_ops = { static const struct devlink_dpipe_table_ops mlxsw_sp_dpipe_table_adj_ops = {
.matches_dump = mlxsw_sp_dpipe_table_adj_matches_dump, .matches_dump = mlxsw_sp_dpipe_table_adj_matches_dump,
.actions_dump = mlxsw_sp_dpipe_table_adj_actions_dump, .actions_dump = mlxsw_sp_dpipe_table_adj_actions_dump,
.entries_dump = mlxsw_sp_dpipe_table_adj_entries_dump, .entries_dump = mlxsw_sp_dpipe_table_adj_entries_dump,
......
...@@ -352,7 +352,7 @@ struct devlink_dpipe_table { ...@@ -352,7 +352,7 @@ struct devlink_dpipe_table {
bool resource_valid; bool resource_valid;
u64 resource_id; u64 resource_id;
u64 resource_units; u64 resource_units;
struct devlink_dpipe_table_ops *table_ops; const struct devlink_dpipe_table_ops *table_ops;
struct rcu_head rcu; struct rcu_head rcu;
}; };
...@@ -1751,7 +1751,7 @@ void devl_sb_unregister(struct devlink *devlink, unsigned int sb_index); ...@@ -1751,7 +1751,7 @@ void devl_sb_unregister(struct devlink *devlink, unsigned int sb_index);
void devlink_sb_unregister(struct devlink *devlink, unsigned int sb_index); void devlink_sb_unregister(struct devlink *devlink, unsigned int sb_index);
int devl_dpipe_table_register(struct devlink *devlink, int devl_dpipe_table_register(struct devlink *devlink,
const char *table_name, const char *table_name,
struct devlink_dpipe_table_ops *table_ops, const struct devlink_dpipe_table_ops *table_ops,
void *priv, bool counter_control_extern); void *priv, bool counter_control_extern);
void devl_dpipe_table_unregister(struct devlink *devlink, void devl_dpipe_table_unregister(struct devlink *devlink,
const char *table_name); const char *table_name);
......
...@@ -839,7 +839,7 @@ EXPORT_SYMBOL_GPL(devlink_dpipe_table_counter_enabled); ...@@ -839,7 +839,7 @@ EXPORT_SYMBOL_GPL(devlink_dpipe_table_counter_enabled);
*/ */
int devl_dpipe_table_register(struct devlink *devlink, int devl_dpipe_table_register(struct devlink *devlink,
const char *table_name, const char *table_name,
struct devlink_dpipe_table_ops *table_ops, const struct devlink_dpipe_table_ops *table_ops,
void *priv, bool counter_control_extern) void *priv, bool counter_control_extern)
{ {
struct devlink_dpipe_table *table; struct devlink_dpipe_table *table;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment