staging: most: net: use DEFINE_MUTEX() for mutex lock
authorZheng Yongjun <zhengyongjun3@huawei.com>
Thu, 24 Dec 2020 13:25:19 +0000 (21:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Dec 2020 14:09:28 +0000 (15:09 +0100)
mutex lock can be initialized automatically with DEFINE_MUTEX()
rather than explicitly calling mutex_init().

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Link: https://lore.kernel.org/r/20201224132519.31504-1-zhengyongjun3@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/net/net.c

index b6fecb06a0e60e02b60e6b98ec34a49bb4a4207a..f125bb6da406fa480c5dc195b7454b74963b2c54 100644 (file)
@@ -68,7 +68,7 @@ struct net_dev_context {
 };
 
 static struct list_head net_devices = LIST_HEAD_INIT(net_devices);
-static struct mutex probe_disc_mt; /* ch->linked = true, most_nd_open */
+static DEFINE_MUTEX(probe_disc_mt); /* ch->linked = true, most_nd_open */
 static DEFINE_SPINLOCK(list_lock); /* list_head, ch->linked = false, dev_hold */
 static struct most_component comp;
 
@@ -520,7 +520,6 @@ static int __init most_net_init(void)
 {
        int err;
 
-       mutex_init(&probe_disc_mt);
        err = most_register_component(&comp);
        if (err)
                return err;