[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221005050027.39591-18-kch@nvidia.com>
Date: Tue, 4 Oct 2022 22:00:26 -0700
From: Chaitanya Kulkarni <kch@...dia.com>
To: <ogeert@...ux-m68k.org>, <linux-block@...r.kernel.org>,
<linux-m68k@...ts.linux-m68k.org>, <linux-kernel@...r.kernel.org>,
<drbd-dev@...ts.linbit.com>, <nbd@...er.debian.org>,
<linux-mtd@...ts.infradead.org>
CC: <axboe@...nel.dk>, <philipp.reisner@...bit.com>,
<lars.ellenberg@...bit.com>, <christoph.boehmwalder@...bit.com>,
<efremov@...ux.com>, <josef@...icpanda.com>, <tim@...erelk.net>,
<haris.iqbal@...os.com>, <jinpu.wang@...os.com>, <richard@....at>,
<miquel.raynal@...tlin.com>, <vigneshr@...com>, <kch@...dia.com>,
<mcgrof@...nel.org>, <hare@...e.de>,
<damien.lemoal@...nsource.wdc.com>, <johannes.thumshirn@....com>,
<bvanassche@....org>, <ming.lei@...hat.com>,
<vincent.fu@...sung.com>, <shinichiro.kawasaki@....com>
Subject: [RFC PATCH 17/18] z2ram: use init disk helper
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 <kch@...dia.com>
---
drivers/block/z2ram.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index c1e85f356e4d..74432fbfe42c 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -324,11 +324,8 @@ static int z2ram_register_disk(int minor)
if (IS_ERR(disk))
return PTR_ERR(disk);
- disk->major = Z2RAM_MAJOR;
- disk->first_minor = minor;
- disk->minors = 1;
disk->flags |= GENHD_FL_NO_PART;
- disk->fops = &z2_fops;
+ init_disk(disk, Z2RAM_MAJOR, minor, 1, 0, NULL, &z2_fops);
if (minor)
sprintf(disk->disk_name, "z2ram%d", minor);
else
--
2.29.0
Powered by blists - more mailing lists