Hi,
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.
-ck
Chaitanya Kulkarni (18):
block: add and use init disk helper
nfblock: use init disk helper
amiflop: use init disk helper
brd: use init disk helper
drbd: use init disk helper
floppy: use init disk helper
loop: use init disk helper
n64cart: use init disk helper
nbd: use init disk helper
pcd: use init disk helper
pd: use init disk helper
pf: use init disk helper
pktcdvd: use init disk helper
rnbd-clt: use init disk helper
swim: use init disk helper
swim3: use init disk helper
z2ram: use init disk helper
ubi: use init disk helper
arch/m68k/emu/nfblock.c | 8 ++------
block/genhd.c | 13 +++++++++++++
drivers/block/amiflop.c | 8 ++------
drivers/block/ataflop.c | 8 ++------
drivers/block/brd.c | 9 ++-------
drivers/block/drbd/drbd_main.c | 6 +-----
drivers/block/floppy.c | 8 ++------
drivers/block/loop.c | 7 ++-----
drivers/block/n64cart.c | 4 +---
drivers/block/nbd.c | 7 ++-----
drivers/block/null_blk/main.c | 12 ++++--------
drivers/block/paride/pcd.c | 5 +----
drivers/block/paride/pd.c | 8 ++------
drivers/block/paride/pf.c | 6 +-----
drivers/block/pktcdvd.c | 6 +-----
drivers/block/rnbd/rnbd-clt.c | 9 +++------
drivers/block/swim.c | 7 ++-----
drivers/block/swim3.c | 8 ++------
drivers/block/z2ram.c | 5 +----
drivers/mtd/ubi/block.c | 6 +-----
include/linux/blkdev.h | 5 +++++
21 files changed, 52 insertions(+), 103 deletions(-)
--
2.29.0
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 <[email protected]>
---
drivers/block/pktcdvd.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 4cea3b08087e..db8f4ca5c09c 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2698,13 +2698,9 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev)
if (!disk)
goto out_mem;
pd->disk = disk;
- disk->major = pktdev_major;
- disk->first_minor = idx;
- disk->minors = 1;
- disk->fops = &pktcdvd_ops;
disk->flags = GENHD_FL_REMOVABLE | GENHD_FL_NO_PART;
strcpy(disk->disk_name, pd->name);
- disk->private_data = pd;
+ init_disk(disk, pktdev_major, idx, 1, 0, pd, &pktcdvd_ops);
pd->pkt_dev = MKDEV(pktdev_major, idx);
ret = pkt_new_dev(pd, dev);
--
2.29.0