lkml.org 
[lkml]   [2022]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 17/18] z2ram: use init disk helper
Date
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@nvidia.com>
---
drivers/block/z2ram.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index c1e85f356e4d..74432fbfe42c 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -324,11 +324,8 @@ static int z2ram_register_disk(int minor)
if (IS_ERR(disk))
return PTR_ERR(disk);

- disk->major = Z2RAM_MAJOR;
- disk->first_minor = minor;
- disk->minors = 1;
disk->flags |= GENHD_FL_NO_PART;
- disk->fops = &z2_fops;
+ init_disk(disk, Z2RAM_MAJOR, minor, 1, 0, NULL, &z2_fops);
if (minor)
sprintf(disk->disk_name, "z2ram%d", minor);
else
--
2.29.0
\
 
 \ /
  Last update: 2022-10-05 07:07    [W:0.150 / U:0.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site