public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-block@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
	Hannes Reinecke <hare@suse.com>
Subject: [PATCH 1/6] genhd: drop 'bool' argument from __device_add_disk()
Date: Mon, 30 Jul 2018 09:12:22 +0200	[thread overview]
Message-ID: <20180730071227.22887-2-hare@suse.de> (raw)
In-Reply-To: <20180730071227.22887-1-hare@suse.de>

Split off the last part of __device_add_disk() and move it into the
caller.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 block/genhd.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 8cc719a37b32..62aba3d8ae19 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -647,15 +647,13 @@ static void register_disk(struct device *parent, struct gendisk *disk)
  * __device_add_disk - add disk information to kernel list
  * @parent: parent device for the disk
  * @disk: per-device partitioning information
- * @register_queue: register the queue if set to true
  *
  * This function registers the partitioning information in @disk
  * with the kernel.
  *
  * FIXME: error handling
  */
-static void __device_add_disk(struct device *parent, struct gendisk *disk,
-			      bool register_queue)
+static void __device_add_disk(struct device *parent, struct gendisk *disk)
 {
 	dev_t devt;
 	int retval;
@@ -699,8 +697,13 @@ static void __device_add_disk(struct device *parent, struct gendisk *disk,
 				    exact_match, exact_lock, disk);
 	}
 	register_disk(parent, disk);
-	if (register_queue)
-		blk_register_queue(disk);
+}
+
+void device_add_disk(struct device *parent, struct gendisk *disk)
+{
+	__device_add_disk(parent, disk);
+
+	blk_register_queue(disk);
 
 	/*
 	 * Take an extra ref on queue which will be put on disk_release()
@@ -711,16 +714,19 @@ static void __device_add_disk(struct device *parent, struct gendisk *disk,
 	disk_add_events(disk);
 	blk_integrity_add(disk);
 }
-
-void device_add_disk(struct device *parent, struct gendisk *disk)
-{
-	__device_add_disk(parent, disk, true);
-}
 EXPORT_SYMBOL(device_add_disk);
 
 void device_add_disk_no_queue_reg(struct device *parent, struct gendisk *disk)
 {
-	__device_add_disk(parent, disk, false);
+	__device_add_disk(parent, disk);
+	/*
+	 * Take an extra ref on queue which will be put on disk_release()
+	 * so that it sticks around as long as @disk is there.
+	 */
+	WARN_ON_ONCE(!blk_get_queue(disk->queue));
+
+	disk_add_events(disk);
+	blk_integrity_add(disk);
 }
 EXPORT_SYMBOL(device_add_disk_no_queue_reg);
 
-- 
2.12.3

  reply	other threads:[~2018-07-30  7:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-30  7:12 [PATCH 0/6] genhd: register default groups with device_add_disk() Hannes Reinecke
2018-07-30  7:12 ` Hannes Reinecke [this message]
2018-07-30  8:56   ` [PATCH 1/6] genhd: drop 'bool' argument from __device_add_disk() Christoph Hellwig
2018-07-30  8:57     ` Hannes Reinecke
2018-08-13 19:53       ` Bart Van Assche
2018-07-30  7:12 ` [PATCH 2/6] block: genhd: add 'groups' argument to device_add_disk Hannes Reinecke
2018-07-30  8:57   ` Christoph Hellwig
2018-07-30  7:12 ` [PATCH 3/6] nvme: register ns_id attributes as default sysfs groups Hannes Reinecke
2018-07-30  8:59   ` Christoph Hellwig
2018-08-13 19:51   ` Bart Van Assche
2018-08-14  6:19     ` Hannes Reinecke
2018-07-30  7:12 ` [PATCH 4/6] aoe: use device_add_disk_with_groups() Hannes Reinecke
2018-07-30  9:01   ` Christoph Hellwig
2018-08-01  1:00   ` Ed Cashin
2018-08-01  6:57     ` Hannes Reinecke
2018-08-02 11:55       ` Ed Cashin
2018-07-30  7:12 ` [PATCH 5/6] zram: register default groups with device_add_disk() Hannes Reinecke
2018-07-30  9:02   ` Christoph Hellwig
2018-07-30  7:12 ` [PATCH 6/6] virtio-blk: modernize sysfs attribute creation Hannes Reinecke
2018-07-30  9:03   ` Christoph Hellwig
2018-07-31 15:11   ` Michael S. Tsirkin
2018-07-31 15:19     ` Christoph Hellwig

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=20180730071227.22887-2-hare@suse.de \
    --to=hare@suse.de \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    /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