aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/devlink.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@nvidia.com>2022-07-16 13:02:40 +0200
committerJakub Kicinski <kuba@kernel.org>2022-07-18 20:10:48 -0700
commit012ec02ae4410207f796a9b280a60b80b6cc790a (patch)
tree1eef5b367c809deb578a70577225e226adde3b56 /net/core/devlink.c
parentnet: devlink: add unlocked variants of devlink_region_create/destroy() functions (diff)
downloadlinux-dev-012ec02ae4410207f796a9b280a60b80b6cc790a.tar.xz
linux-dev-012ec02ae4410207f796a9b280a60b80b6cc790a.zip
netdevsim: convert driver to use unlocked devlink API during init/fini
Prepare for devlink reload being called with devlink->lock held and convert the netdevsim driver to use unlocked devlink API during init and fini flows. Take devl_lock() in reload_down() and reload_up() ops in the meantime before reload cmd is converted to take the lock itself. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core/devlink.c')
-rw-r--r--net/core/devlink.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c
index fe9657d6162f..1c75de6f6388 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -266,6 +266,12 @@ void devl_lock(struct devlink *devlink)
}
EXPORT_SYMBOL_GPL(devl_lock);
+int devl_trylock(struct devlink *devlink)
+{
+ return mutex_trylock(&devlink->lock);
+}
+EXPORT_SYMBOL_GPL(devl_trylock);
+
void devl_unlock(struct devlink *devlink)
{
mutex_unlock(&devlink->lock);