[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221005050027.39591-4-kch@nvidia.com>
Date: Tue, 4 Oct 2022 22:00:12 -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 03/18] amiflop: 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/amiflop.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 4c8b2ba579ee..40f220fd61a7 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -1786,18 +1786,14 @@ static int fd_alloc_disk(int drive, int system)
if (IS_ERR(disk))
return PTR_ERR(disk);
- disk->major = FLOPPY_MAJOR;
- disk->first_minor = drive + system;
- disk->minors = 1;
- disk->fops = &floppy_fops;
disk->flags |= GENHD_FL_NO_PART;
disk->events = DISK_EVENT_MEDIA_CHANGE;
if (system)
sprintf(disk->disk_name, "fd%d_msdos", drive);
else
sprintf(disk->disk_name, "fd%d", drive);
- disk->private_data = &unit[drive];
- set_capacity(disk, 880 * 2);
+ init_disk(disk, FLOPPY_MAJOR, drive + system, 1, 880 * 2, &unit[drive],
+ &floppy_fops);
unit[drive].gendisk[system] = disk;
err = add_disk(disk);
--
2.29.0
Powered by blists - more mailing lists