2021-04-06 21:03:49

by Huang Guobin

[permalink] [raw]
Subject: [PATCH -next] dlm: use DEFINE_SPINLOCK() for spinlock

From: Guobin Huang <[email protected]>

spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Guobin Huang <[email protected]>
---
fs/dlm/plock.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
index c38b2b8ffd1d..5a24a2271fdd 100644
--- a/fs/dlm/plock.c
+++ b/fs/dlm/plock.c
@@ -13,7 +13,7 @@
#include "dlm_internal.h"
#include "lockspace.h"

-static spinlock_t ops_lock;
+static DEFINE_SPINLOCK(ops_lock);
static struct list_head send_list;
static struct list_head recv_list;
static wait_queue_head_t send_wq;
@@ -492,7 +492,6 @@ int dlm_plock_init(void)
{
int rv;

- spin_lock_init(&ops_lock);
INIT_LIST_HEAD(&send_list);
INIT_LIST_HEAD(&recv_list);
init_waitqueue_head(&send_wq);