Skip to content

Commit

Permalink
devlink: Create a helper function for one parameter registration
Browse files Browse the repository at this point in the history
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: Parav Pandit <[email protected]>
Reviewed-by: Jiri Pirko <[email protected]>
Reviewed-by: Leon Romanovsky <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
paravmellanox authored and davem330 committed Aug 11, 2021
1 parent 076b2a9 commit 699784f
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions net/core/devlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -9800,6 +9800,22 @@ static int devlink_param_verify(const struct devlink_param *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,
unsigned int port_index,
struct list_head *param_list,
Expand All @@ -9814,12 +9830,8 @@ static int __devlink_params_register(struct devlink *devlink,

mutex_lock(&devlink->lock);
for (i = 0; i < params_count; i++, param++) {
err = devlink_param_verify(param);
if (err)
goto rollback;

err = devlink_param_register_one(devlink, port_index,
param_list, param, reg_cmd);
err = __devlink_param_register_one(devlink, port_index,
param_list, param, reg_cmd);
if (err)
goto rollback;
}
Expand Down

0 comments on commit 699784f

Please sign in to comment.