Skip to content

Commit

Permalink
NVMe: don't allocate unused nvme_major
Browse files Browse the repository at this point in the history
When alloc_disk(0) is used, the ->major number is ignored.  All device
numbers are allocated with a major of BLOCK_EXT_MAJOR.

So remove all references to nvme_major.

[[email protected]: one unregister_blkdev() was missed]
Link: http://lkml.kernel.org/r/20160602064318.4403.93301.stgit@noble
Signed-off-by: NeilBrown <[email protected]>
Reviewed-by: Keith Busch <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Maxim Levitsky <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
NeilBrown authored and axboe committed Jul 14, 2016
1 parent 2fa8435 commit b09dcf5
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ module_param_named(max_retries, nvme_max_retries, uint, 0644);
MODULE_PARM_DESC(max_retries, "max number of retries a command may have");
EXPORT_SYMBOL_GPL(nvme_max_retries);

static int nvme_major;
module_param(nvme_major, int, 0);

static int nvme_char_major;
module_param(nvme_char_major, int, 0);

Expand Down Expand Up @@ -1674,8 +1671,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
blk_queue_logical_block_size(ns->queue, 1 << ns->lba_shift);
nvme_set_queue_limits(ctrl, ns->queue);

disk->major = nvme_major;
disk->first_minor = 0;
disk->fops = &nvme_fops;
disk->private_data = ns;
disk->queue = ns->queue;
Expand Down Expand Up @@ -2085,16 +2080,10 @@ int __init nvme_core_init(void)
{
int result;

result = register_blkdev(nvme_major, "nvme");
if (result < 0)
return result;
else if (result > 0)
nvme_major = result;

result = __register_chrdev(nvme_char_major, 0, NVME_MINORS, "nvme",
&nvme_dev_fops);
if (result < 0)
goto unregister_blkdev;
return result;
else if (result > 0)
nvme_char_major = result;

Expand All @@ -2108,16 +2097,13 @@ int __init nvme_core_init(void)

unregister_chrdev:
__unregister_chrdev(nvme_char_major, 0, NVME_MINORS, "nvme");
unregister_blkdev:
unregister_blkdev(nvme_major, "nvme");
return result;
}

void nvme_core_exit(void)
{
class_destroy(nvme_class);
__unregister_chrdev(nvme_char_major, 0, NVME_MINORS, "nvme");
unregister_blkdev(nvme_major, "nvme");
}

MODULE_LICENSE("GPL");
Expand Down

0 comments on commit b09dcf5

Please sign in to comment.