Commit 699784f7 authored by Parav Pandit's avatar Parav Pandit Committed by David S. Miller

devlink: Create a helper function for one parameter registration

Create and use a helper function for one parameter registration.
Subsequent patch also will reuse this for driver facing routine to
register a single parameter.
Signed-off-by: default avatarParav Pandit <parav@nvidia.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 076b2a9d
...@@ -9800,6 +9800,22 @@ static int devlink_param_verify(const struct devlink_param *param) ...@@ -9800,6 +9800,22 @@ static int devlink_param_verify(const struct devlink_param *param)
return devlink_param_driver_verify(param); return devlink_param_driver_verify(param);
} }
static int __devlink_param_register_one(struct devlink *devlink,
unsigned int port_index,
struct list_head *param_list,
const struct devlink_param *param,
enum devlink_command reg_cmd)
{
int err;
err = devlink_param_verify(param);
if (err)
return err;
return devlink_param_register_one(devlink, port_index,
param_list, param, reg_cmd);
}
static int __devlink_params_register(struct devlink *devlink, static int __devlink_params_register(struct devlink *devlink,
unsigned int port_index, unsigned int port_index,
struct list_head *param_list, struct list_head *param_list,
...@@ -9814,12 +9830,8 @@ static int __devlink_params_register(struct devlink *devlink, ...@@ -9814,12 +9830,8 @@ static int __devlink_params_register(struct devlink *devlink,
mutex_lock(&devlink->lock); mutex_lock(&devlink->lock);
for (i = 0; i < params_count; i++, param++) { for (i = 0; i < params_count; i++, param++) {
err = devlink_param_verify(param); err = __devlink_param_register_one(devlink, port_index,
if (err) param_list, param, reg_cmd);
goto rollback;
err = devlink_param_register_one(devlink, port_index,
param_list, param, reg_cmd);
if (err) if (err)
goto rollback; goto rollback;
} }
......
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