lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 4 Oct 2022 22:00:25 -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 16/18] swim3: 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/swim3.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index da811a7da03f..3c1b92b464d1 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -1221,15 +1221,11 @@ static int swim3_attach(struct macio_dev *mdev,
 	if (rc)
 		goto out_cleanup_disk;
 
-	disk->major = FLOPPY_MAJOR;
-	disk->first_minor = floppy_count;
-	disk->minors = 1;
-	disk->fops = &floppy_fops;
-	disk->private_data = fs;
 	disk->events = DISK_EVENT_MEDIA_CHANGE;
 	disk->flags |= GENHD_FL_REMOVABLE | GENHD_FL_NO_PART;
 	sprintf(disk->disk_name, "fd%d", floppy_count);
-	set_capacity(disk, 2880);
+	init_disk(swd->unit[drive].disk, FLOPPY_MAJOR, floppy_count, 1, 2880,
+			&fs, &floopy_dops);
 	rc = add_disk(disk);
 	if (rc)
 		goto out_cleanup_disk;
-- 
2.29.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ