From patchwork Wed Jul 25 06:28:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 10543479 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 428971822 for ; Wed, 25 Jul 2018 06:28:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31C812965E for ; Wed, 25 Jul 2018 06:28:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2439F2966F; Wed, 25 Jul 2018 06:28:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A651D29640 for ; Wed, 25 Jul 2018 06:28:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728073AbeGYHiy (ORCPT ); Wed, 25 Jul 2018 03:38:54 -0400 Received: from mx2.suse.de ([195.135.220.15]:47166 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728316AbeGYHiy (ORCPT ); Wed, 25 Jul 2018 03:38:54 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BE74AACF3; Wed, 25 Jul 2018 06:28:41 +0000 (UTC) From: Hannes Reinecke To: Jens Axboe Cc: Christoph Hellwig , Keith Busch , Sagi Grimberg , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Martin Wilck , Hannes Reinecke , Hannes Reinecke Subject: [PATCH 1/5] genhd: drop 'bool' argument from __device_add_disk() Date: Wed, 25 Jul 2018 08:28:36 +0200 Message-Id: <20180725062840.94114-2-hare@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180725062840.94114-1-hare@suse.de> References: <20180725062840.94114-1-hare@suse.de> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Split off the last part of __device_add_disk() into __device_get_disk(). With that we can drop the 'bool' argument and streamline the function. Signed-off-by: Hannes Reinecke --- block/genhd.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index f1543a45e73b..cfa7f4f78435 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,9 +697,10 @@ 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_get_disk(struct gendisk *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. @@ -714,13 +713,18 @@ static void __device_add_disk(struct device *parent, struct gendisk *disk, void device_add_disk(struct device *parent, struct gendisk *disk) { - __device_add_disk(parent, disk, true); + __device_add_disk(parent, disk); + + blk_register_queue(disk); + + __device_get_disk(disk); } 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); + __device_get_disk(disk); } EXPORT_SYMBOL(device_add_disk_no_queue_reg);