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]
Message-ID: <20221005050027.39591-13-kch@nvidia.com>
Date:   Tue, 4 Oct 2022 22:00:21 -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 12/18] pf: 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/pf.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index eec1b9fde245..2950642402a8 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -937,15 +937,11 @@ static int __init pf_init_unit(struct pf_unit *pf, bool autoprobe, int port,
 		ret = PTR_ERR(disk);
 		goto out_free_tag_set;
 	}
-	disk->major = major;
-	disk->first_minor = pf - units;
-	disk->minors = 1;
 	strcpy(disk->disk_name, pf->name);
-	disk->fops = &pf_fops;
 	disk->flags |= GENHD_FL_NO_PART;
 	disk->events = DISK_EVENT_MEDIA_CHANGE;
-	disk->private_data = pf;
 
+	init_disk(disk, major, pf - units, 1, 0, pf, &pf_ops);
 	blk_queue_max_segments(disk->queue, cluster);
 	blk_queue_bounce_limit(disk->queue, BLK_BOUNCE_HIGH);
 
-- 
2.29.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ