linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yufen Yu <yuyufen@huawei.com>
To: <axboe@kernel.dk>
Cc: <linux-block@vger.kernel.org>, <ming.lei@redhat.com>, <hch@lst.de>
Subject: [RESEND PATCH v2 6/7] block: get rid of unnecessary local variable
Date: Thu, 8 Oct 2020 23:26:32 -0400	[thread overview]
Message-ID: <20201009032633.83645-7-yuyufen@huawei.com> (raw)
In-Reply-To: <20201009032633.83645-1-yuyufen@huawei.com>

Since whole elevator register is protectd by sysfs_lock, we
don't need extras 'has_elevator'. Just use q->elevator directly.

Signed-off-by: Yufen Yu <yuyufen@huawei.com>
---
 block/blk-sysfs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index ee2cd4d1054c..d13a70ed39bf 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -976,7 +976,6 @@ int blk_register_queue(struct gendisk *disk)
 	int ret;
 	struct device *dev = disk_to_dev(disk);
 	struct request_queue *q = disk->queue;
-	bool has_elevator = false;
 
 	if (WARN_ON(!q))
 		return -ENXIO;
@@ -1040,7 +1039,6 @@ int blk_register_queue(struct gendisk *disk)
 			kobject_put(&dev->kobj);
 			return ret;
 		}
-		has_elevator = true;
 	}
 
 	blk_queue_flag_set(QUEUE_FLAG_REGISTERED, q);
@@ -1049,7 +1047,7 @@ int blk_register_queue(struct gendisk *disk)
 
 	/* Now everything is ready and send out KOBJ_ADD uevent */
 	kobject_uevent(&q->kobj, KOBJ_ADD);
-	if (has_elevator)
+	if (q->elevator)
 		kobject_uevent(&q->elevator->kobj, KOBJ_ADD);
 	mutex_unlock(&q->sysfs_lock);
 
-- 
2.25.4


  parent reply	other threads:[~2020-10-09  3:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-09  3:26 [RESEND PATCH v2 0/7] some improvements and cleanups for block Yufen Yu
2020-10-09  3:26 ` [RESEND PATCH v2 1/7] block: invoke blk_mq_exit_sched no matter whether have .exit_sched Yufen Yu
2020-10-09  3:26 ` [RESEND PATCH v2 2/7] block: remove redundant mq check Yufen Yu
2020-10-09  3:26 ` [RESEND PATCH v2 3/7] block: use helper function to test queue register Yufen Yu
2020-10-09  3:26 ` [RESEND PATCH v2 4/7] blk-mq: use helper function to test hw stopped Yufen Yu
2020-10-09  3:26 ` [RESEND PATCH v2 5/7] block: fix comment and add lockdep assert Yufen Yu
2020-10-09  3:26 ` Yufen Yu [this message]
2020-10-09  3:26 ` [RESEND PATCH v2 7/7] blk-mq: get rid of the dead flush handle code path Yufen Yu
2020-10-09 18:45 ` [RESEND PATCH v2 0/7] some improvements and cleanups for block Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201009032633.83645-7-yuyufen@huawei.com \
    --to=yuyufen@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).