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:27 -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 18/18] ubi: 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/mtd/ubi/block.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index 4cf67a2a0d04..07c085a5fd52 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -420,9 +420,7 @@ int ubiblock_create(struct ubi_volume_info *vi)
 		goto out_free_tags;
 	}
 
-	gd->fops = &ubiblock_ops;
-	gd->major = ubiblock_major;
-	gd->minors = 1;
+	init_disk(gd, ubiblock_major, 1, 0, disk_capacity, dev, &ubiblock_ops);
 	gd->first_minor = idr_alloc(&ubiblock_minor_idr, dev, 0, 0, GFP_KERNEL);
 	if (gd->first_minor < 0) {
 		dev_err(disk_to_dev(gd),
@@ -431,9 +429,7 @@ int ubiblock_create(struct ubi_volume_info *vi)
 		goto out_cleanup_disk;
 	}
 	gd->flags |= GENHD_FL_NO_PART;
-	gd->private_data = dev;
 	sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id);
-	set_capacity(gd, disk_capacity);
 	dev->gd = gd;
 
 	dev->rq = gd->queue;
-- 
2.29.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ