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-9-kch@nvidia.com>
Date:   Tue, 4 Oct 2022 22:00:17 -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 08/18] n64cart: 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/n64cart.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/block/n64cart.c b/drivers/block/n64cart.c
index d914156db2d8..28b32fbe6586 100644
--- a/drivers/block/n64cart.c
+++ b/drivers/block/n64cart.c
@@ -135,14 +135,12 @@ static int __init n64cart_probe(struct platform_device *pdev)
 	if (!disk)
 		goto out;
 
-	disk->first_minor = 0;
 	disk->flags = GENHD_FL_NO_PART;
 	disk->fops = &n64cart_fops;
-	disk->private_data = &pdev->dev;
 	strcpy(disk->disk_name, "n64cart");
 
-	set_capacity(disk, size >> SECTOR_SHIFT);
 	set_disk_ro(disk, 1);
+	init_disk(disk, 0, 0, 0, size >> 9, &pdev->dev, &n64cart_fops);
 
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
 	blk_queue_physical_block_size(disk->queue, 4096);
-- 
2.29.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ