[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221005050027.39591-12-kch@nvidia.com>
Date: Tue, 4 Oct 2022 22:00:20 -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 11/18] pd: 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/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
Powered by blists - more mailing lists