* [PATCH -next] block: use DEFINE_MUTEX() for mutex lock
@ 2021-04-09 9:51 Ye Bin
0 siblings, 0 replies; 2+ messages in thread
From: Ye Bin @ 2021-04-09 9:51 UTC (permalink / raw)
To: yebin10, linux-block, Jens Axboe; +Cc: kernel-janitors, Hulk Robot
mutex lock can be initialized automatically with DEFINE_MUTEX()
rather than explicitly calling mutex_init().
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
---
drivers/block/pktcdvd.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index fc4b0f1aa86d..699ed8bbdbdf 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -96,7 +96,7 @@ static struct proc_dir_entry *pkt_proc;
static int pktdev_major;
static int write_congestion_on = PKT_WRITE_CONGESTION_ON;
static int write_congestion_off = PKT_WRITE_CONGESTION_OFF;
-static struct mutex ctl_mutex; /* Serialize open/close/setup/teardown */
+static DEFINE_MUTEX(ctl_mutex); /* Serialize open/close/setup/teardown */
static mempool_t psd_pool;
static struct bio_set pkt_bio_set;
@@ -2858,8 +2858,6 @@ static int __init pkt_init(void)
{
int ret;
- mutex_init(&ctl_mutex);
-
ret = mempool_init_kmalloc_pool(&psd_pool, PSD_POOL_SIZE,
sizeof(struct packet_stacked_data));
if (ret)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH -next] block: use DEFINE_MUTEX() for mutex lock
@ 2021-04-05 10:14 Zheng Yongjun
0 siblings, 0 replies; 2+ messages in thread
From: Zheng Yongjun @ 2021-04-05 10:14 UTC (permalink / raw)
To: zhengyongjun3, Jens Axboe, Johannes Thumshirn, Damien Le Moal,
Chaitanya Kulkarni, Daniel Wagner, Bart Van Assche, Hou Pu,
Aravind Ramesh, John Garry
Cc: linux-block, kernel-janitors, Hulk Robot
mutex lock can be initialized automatically with DEFINE_MUTEX()
rather than explicitly calling mutex_init().
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
drivers/block/null_blk/main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index d6c821d48090..b15df944cde2 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -67,7 +67,7 @@ struct nullb_page {
#define NULLB_PAGE_FREE (MAP_SZ - 2)
static LIST_HEAD(nullb_list);
-static struct mutex lock;
+static DEFINE_MUTEX(lock);
static int null_major;
static DEFINE_IDA(nullb_indexes);
static struct blk_mq_tag_set tag_set;
@@ -1961,8 +1961,6 @@ static int __init null_init(void)
if (ret)
goto err_tagset;
- mutex_init(&lock);
-
null_major = register_blkdev(0, "nullb");
if (null_major < 0) {
ret = null_major;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-09 9:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 9:51 [PATCH -next] block: use DEFINE_MUTEX() for mutex lock Ye Bin
-- strict thread matches above, loose matches on Subject: below --
2021-04-05 10:14 Zheng Yongjun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).