aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/devlink.c
diff options
context:
space:
mode:
authorMoshe Shemesh <moshe@nvidia.com>2022-07-11 01:14:08 -0700
committerPaolo Abeni <pabeni@redhat.com>2022-07-12 10:26:23 +0200
commitf0680ef0f9497f88b513dea1ae54664f0806ecfb (patch)
treedd85580ea6dd577bdd216c81441f5cce4bdd6705 /net/core/devlink.c
parentnet/mlx5: Remove devl_unlock from mlx5_devlink_eswitch_mode_set (diff)
downloadlinux-dev-f0680ef0f9497f88b513dea1ae54664f0806ecfb.tar.xz
linux-dev-f0680ef0f9497f88b513dea1ae54664f0806ecfb.zip
devlink: Hold the instance lock in port_new / port_del callbacks
Let the core take the devlink instance lock around port_new and port_del callbacks and remove the now redundant locking in the only driver that currently use them. Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/core/devlink.c')
-rw-r--r--net/core/devlink.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 970e5c2a52bd..e206cc90bec5 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -1712,7 +1712,7 @@ static int devlink_port_new_notifiy(struct devlink *devlink,
if (!msg)
return -ENOMEM;
- mutex_lock(&devlink->lock);
+ lockdep_assert_held(&devlink->lock);
devlink_port = devlink_port_get_by_index(devlink, port_index);
if (!devlink_port) {
err = -ENODEV;
@@ -1725,11 +1725,9 @@ static int devlink_port_new_notifiy(struct devlink *devlink,
goto out;
err = genlmsg_reply(msg, info);
- mutex_unlock(&devlink->lock);
return err;
out:
- mutex_unlock(&devlink->lock);
nlmsg_free(msg);
return err;
}
@@ -9067,13 +9065,11 @@ static const struct genl_small_ops devlink_nl_ops[] = {
.cmd = DEVLINK_CMD_PORT_NEW,
.doit = devlink_nl_cmd_port_new_doit,
.flags = GENL_ADMIN_PERM,
- .internal_flags = DEVLINK_NL_FLAG_NO_LOCK,
},
{
.cmd = DEVLINK_CMD_PORT_DEL,
.doit = devlink_nl_cmd_port_del_doit,
.flags = GENL_ADMIN_PERM,
- .internal_flags = DEVLINK_NL_FLAG_NO_LOCK,
},
{
.cmd = DEVLINK_CMD_LINECARD_GET,