[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221005050027.39591-8-kch@nvidia.com>
Date: Tue, 4 Oct 2022 22:00:16 -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 07/18] loop: 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/loop.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index ad92192c7d61..82cdb57ecd18 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -2023,15 +2023,12 @@ static int loop_add(int i)
spin_lock_init(&lo->lo_work_lock);
INIT_WORK(&lo->rootcg_work, loop_rootcg_workfn);
INIT_LIST_HEAD(&lo->rootcg_cmd_list);
- disk->major = LOOP_MAJOR;
- disk->first_minor = i << part_shift;
- disk->minors = 1 << part_shift;
- disk->fops = &lo_fops;
- disk->private_data = lo;
disk->queue = lo->lo_queue;
disk->events = DISK_EVENT_MEDIA_CHANGE;
disk->event_flags = DISK_EVENT_FLAG_UEVENT;
sprintf(disk->disk_name, "loop%d", i);
+ init_disk(disk, LOOP_MAJOR, i << part_shift, 1 << part_shift, 0, lo,
+ &lo_fops);
/* Make this loop device reachable from pathname. */
err = add_disk(disk);
if (err)
--
2.29.0
Powered by blists - more mailing lists