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 11/18] pd: 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/paride/pd.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index f8a75bc90f70..9457ad0cc25f 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -919,12 +919,7 @@ static int pd_probe_drive(struct pd_unit *disk, int autoprobe, int port,
disk->gd = p;

strcpy(p->disk_name, disk->name);
- p->fops = &pd_fops;
- p->major = major;
- p->first_minor = (disk - pd) << PD_BITS;
- p->minors = 1 << PD_BITS;
p->events = DISK_EVENT_MEDIA_CHANGE;
- p->private_data = disk;
blk_queue_max_hw_sectors(p->queue, cluster);
blk_queue_bounce_limit(p->queue, BLK_BOUNCE_HIGH);

@@ -939,7 +934,8 @@ static int pd_probe_drive(struct pd_unit *disk, int autoprobe, int port,
}
if (ret)
goto put_disk;
- set_capacity(disk->gd, disk->capacity);
+ init_disk(disk, major, (disk - pd) << PD_BITS, 1 << PD_BITS,
+ disk->capacity, disk, *pd_fops);
ret = add_disk(disk->gd);
if (ret)
goto cleanup_disk;
--
2.29.0
\
 
 \ /
  Last update: 2022-10-05 07:04    [W:0.116 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site