Message ID | 63d7e04fdfaf44a33d683270d95627afbf90e932.1700047319.git.petrm@nvidia.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | mlxsw: Add support for new reset flow | expand |
On Wed, Nov 15, 2023 at 01:17:12PM +0100, Petr Machata wrote: > From: Ido Schimmel <idosch@nvidia.com> > > Currently, private flags (e.g., 'DEVLINK_NL_FLAG_NEED_PORT') are only > used in pre_doit operations, but a subsequent patch will need to > conditionally lock and unlock the device lock in pre and post doit > operations, respectively. > > As a preparation, enable the use of private flags in post_doit > operations in a similar fashion to how it is done for pre_doit > operations. > > No functional changes intended. > > Signed-off-by: Ido Schimmel <idosch@nvidia.com> > Reviewed-by: Jiri Pirko <jiri@nvidia.com> > Signed-off-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Simon Horman <horms@kernel.org>
diff --git a/net/devlink/netlink.c b/net/devlink/netlink.c index 7350138c8bb4..5bb6624f3288 100644 --- a/net/devlink/netlink.c +++ b/net/devlink/netlink.c @@ -141,14 +141,20 @@ int devlink_nl_pre_doit_port_optional(const struct genl_split_ops *ops, return __devlink_nl_pre_doit(skb, info, DEVLINK_NL_FLAG_NEED_DEVLINK_OR_PORT); } +static void __devlink_nl_post_doit(struct sk_buff *skb, struct genl_info *info, + u8 flags) +{ + struct devlink *devlink; + + devlink = info->user_ptr[0]; + devl_unlock(devlink); + devlink_put(devlink); +} + void devlink_nl_post_doit(const struct genl_split_ops *ops, struct sk_buff *skb, struct genl_info *info) { - struct devlink *devlink; - - devlink = info->user_ptr[0]; - devl_unlock(devlink); - devlink_put(devlink); + __devlink_nl_post_doit(skb, info, 0); } static int devlink_nl_inst_single_dumpit(struct sk_buff *msg,