From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2076.outbound.protection.outlook.com [40.107.223.76]) by mail19.linbit.com (LINBIT Mail Daemon) with ESMTP id BA12A420671 for ; Wed, 5 Oct 2022 07:20:24 +0200 (CEST) From: Chaitanya Kulkarni To: , , , , , , Date: Tue, 4 Oct 2022 22:00:27 -0700 Message-ID: <20221005050027.39591-19-kch@nvidia.com> In-Reply-To: <20221005050027.39591-1-kch@nvidia.com> References: <20221005050027.39591-1-kch@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Cc: axboe@kernel.dk, vincent.fu@samsung.com, ming.lei@redhat.com, kch@nvidia.com, vigneshr@ti.com, richard@nod.at, damien.lemoal@opensource.wdc.com, philipp.reisner@linbit.com, efremov@linux.com, josef@toxicpanda.com, mcgrof@kernel.org, haris.iqbal@ionos.com, hare@suse.de, miquel.raynal@bootlin.com, shinichiro.kawasaki@wdc.com, lars.ellenberg@linbit.com, johannes.thumshirn@wdc.com, jinpu.wang@ionos.com, tim@cyberelk.net, bvanassche@acm.org Subject: [Drbd-dev] [RFC PATCH 18/18] ubi: use init disk helper List-Id: "*Coordination* of development, patches, contributions -- *Questions* \(even to developers\) go to drbd-user, please." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Add and use the helper to initialize the common fields of struct gendisk such as major, first_minor, minors, disk_name, private_data, and ops. This initialization is spread all over the block drivers. This avoids code repetation of inialization code of gendisk in current block drivers and any future ones. Signed-off-by: Chaitanya Kulkarni --- drivers/mtd/ubi/block.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c index 4cf67a2a0d04..07c085a5fd52 100644 --- a/drivers/mtd/ubi/block.c +++ b/drivers/mtd/ubi/block.c @@ -420,9 +420,7 @@ int ubiblock_create(struct ubi_volume_info *vi) goto out_free_tags; } - gd->fops = &ubiblock_ops; - gd->major = ubiblock_major; - gd->minors = 1; + init_disk(gd, ubiblock_major, 1, 0, disk_capacity, dev, &ubiblock_ops); gd->first_minor = idr_alloc(&ubiblock_minor_idr, dev, 0, 0, GFP_KERNEL); if (gd->first_minor < 0) { dev_err(disk_to_dev(gd), @@ -431,9 +429,7 @@ int ubiblock_create(struct ubi_volume_info *vi) goto out_cleanup_disk; } gd->flags |= GENHD_FL_NO_PART; - gd->private_data = dev; sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id); - set_capacity(gd, disk_capacity); dev->gd = gd; dev->rq = gd->queue; -- 2.29.0