Skip to content

Commit

Permalink
genhd: Rename get_disk() to get_disk_and_module()
Browse files Browse the repository at this point in the history
Rename get_disk() to get_disk_and_module() to make sure what the
function does. It's not a great name but at least it is now clear that
put_disk() is not it's counterpart.

Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
jankara authored and axboe committed Feb 26, 2018
1 parent d52987b commit 3079c22
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 15 deletions.
10 changes: 4 additions & 6 deletions block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ static int exact_lock(dev_t devt, void *data)
{
struct gendisk *p = data;

if (!get_disk(p))
if (!get_disk_and_module(p))
return -1;
return 0;
}
Expand Down Expand Up @@ -809,7 +809,7 @@ struct gendisk *get_gendisk(dev_t devt, int *partno)

spin_lock_bh(&ext_devt_lock);
part = idr_find(&ext_devt_idr, blk_mangle_minor(MINOR(devt)));
if (part && get_disk(part_to_disk(part))) {
if (part && get_disk_and_module(part_to_disk(part))) {
*partno = part->partno;
disk = part_to_disk(part);
}
Expand Down Expand Up @@ -1456,7 +1456,7 @@ struct gendisk *__alloc_disk_node(int minors, int node_id)
}
EXPORT_SYMBOL(__alloc_disk_node);

struct kobject *get_disk(struct gendisk *disk)
struct kobject *get_disk_and_module(struct gendisk *disk)
{
struct module *owner;
struct kobject *kobj;
Expand All @@ -1474,15 +1474,13 @@ struct kobject *get_disk(struct gendisk *disk)
return kobj;

}

EXPORT_SYMBOL(get_disk);
EXPORT_SYMBOL(get_disk_and_module);

void put_disk(struct gendisk *disk)
{
if (disk)
kobject_put(&disk_to_dev(disk)->kobj);
}

EXPORT_SYMBOL(put_disk);

static void set_disk_ro_uevent(struct gendisk *gd, int ro)
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/amiflop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
if (unit[drive].type->code == FD_NODRIVE)
return NULL;
*part = 0;
return get_disk(unit[drive].gendisk);
return get_disk_and_module(unit[drive].gendisk);
}

static int __init amiga_floppy_probe(struct platform_device *pdev)
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/ataflop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
if (drive >= FD_MAX_UNITS || type > NUM_DISK_MINORS)
return NULL;
*part = 0;
return get_disk(unit[drive].disk);
return get_disk_and_module(unit[drive].disk);
}

static int __init atari_floppy_init (void)
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/brd.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ static struct kobject *brd_probe(dev_t dev, int *part, void *data)

mutex_lock(&brd_devices_mutex);
brd = brd_init_one(MINOR(dev) / max_part, &new);
kobj = brd ? get_disk(brd->brd_disk) : NULL;
kobj = brd ? get_disk_and_module(brd->brd_disk) : NULL;
mutex_unlock(&brd_devices_mutex);

if (new)
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -4505,7 +4505,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
if (((*part >> 2) & 0x1f) >= ARRAY_SIZE(floppy_type))
return NULL;
*part = 0;
return get_disk(disks[drive]);
return get_disk_and_module(disks[drive]);
}

static int __init do_floppy_init(void)
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1922,7 +1922,7 @@ static struct kobject *loop_probe(dev_t dev, int *part, void *data)
if (err < 0)
kobj = NULL;
else
kobj = get_disk(lo->lo_disk);
kobj = get_disk_and_module(lo->lo_disk);
mutex_unlock(&loop_index_mutex);

*part = 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/swim.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
return NULL;

*part = 0;
return get_disk(swd->unit[drive].disk);
return get_disk_and_module(swd->unit[drive].disk);
}

static int swim_add_floppy(struct swim_priv *swd, enum drive_location location)
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/z2ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ static const struct block_device_operations z2_fops =
static struct kobject *z2_find(dev_t dev, int *part, void *data)
{
*part = 0;
return get_disk(z2ram_gendisk);
return get_disk_and_module(z2ram_gendisk);
}

static struct request_queue *z2_queue;
Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/ide-probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ static int exact_lock(dev_t dev, void *data)
{
struct gendisk *p = data;

if (!get_disk(p))
if (!get_disk_and_module(p))
return -1;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion include/linux/genhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ extern void delete_partition(struct gendisk *, int);
extern void printk_all_partitions(void);

extern struct gendisk *__alloc_disk_node(int minors, int node_id);
extern struct kobject *get_disk(struct gendisk *disk);
extern struct kobject *get_disk_and_module(struct gendisk *disk);
extern void put_disk(struct gendisk *disk);
extern void blk_register_region(dev_t devt, unsigned long range,
struct module *module,
Expand Down

0 comments on commit 3079c22

Please sign in to comment.