From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2074.outbound.protection.outlook.com [40.107.94.74]) by mail19.linbit.com (LINBIT Mail Daemon) with ESMTP id 40F0042095F for ; Wed, 5 Oct 2022 07:17:55 +0200 (CEST) From: Chaitanya Kulkarni To: , , , , , , Date: Tue, 4 Oct 2022 22:00:20 -0700 Message-ID: <20221005050027.39591-12-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 11/18] pd: 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/block/paride/pd.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index f8a75bc90f70..9457ad0cc25f 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c @@ -919,12 +919,7 @@ static int pd_probe_drive(struct pd_unit *disk, int autoprobe, int port, disk->gd = p; strcpy(p->disk_name, disk->name); - p->fops = &pd_fops; - p->major = major; - p->first_minor = (disk - pd) << PD_BITS; - p->minors = 1 << PD_BITS; p->events = DISK_EVENT_MEDIA_CHANGE; - p->private_data = disk; blk_queue_max_hw_sectors(p->queue, cluster); blk_queue_bounce_limit(p->queue, BLK_BOUNCE_HIGH); @@ -939,7 +934,8 @@ static int pd_probe_drive(struct pd_unit *disk, int autoprobe, int port, } if (ret) goto put_disk; - set_capacity(disk->gd, disk->capacity); + init_disk(disk, major, (disk - pd) << PD_BITS, 1 << PD_BITS, + disk->capacity, disk, *pd_fops); ret = add_disk(disk->gd); if (ret) goto cleanup_disk; -- 2.29.0