Skip to content

Commit

Permalink
nvdimm/btt: don't allocate unused major device number
Browse files Browse the repository at this point in the history
alloc_disk(0) does not require or use a ->major number,
all devices are allocated with a major of BLOCK_EXT_MAJOR.

So don't allocate btt_major.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
  • Loading branch information
NeilBrown authored and Dan Williams committed Mar 9, 2016
1 parent ec56151 commit ff8e92d
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions drivers/nvdimm/btt.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ enum log_ent_request {
LOG_OLD_ENT
};

static int btt_major;

static int arena_read_bytes(struct arena_info *arena, resource_size_t offset,
void *buf, size_t n)
{
Expand Down Expand Up @@ -1246,7 +1244,6 @@ static int btt_blk_init(struct btt *btt)

nvdimm_namespace_disk_name(ndns, btt->btt_disk->disk_name);
btt->btt_disk->driverfs_dev = &btt->nd_btt->dev;
btt->btt_disk->major = btt_major;
btt->btt_disk->first_minor = 0;
btt->btt_disk->fops = &btt_fops;
btt->btt_disk->private_data = btt;
Expand Down Expand Up @@ -1423,30 +1420,18 @@ EXPORT_SYMBOL(nvdimm_namespace_detach_btt);

static int __init nd_btt_init(void)
{
int rc;

btt_major = register_blkdev(0, "btt");
if (btt_major < 0)
return btt_major;
int rc = 0;

debugfs_root = debugfs_create_dir("btt", NULL);
if (IS_ERR_OR_NULL(debugfs_root)) {
if (IS_ERR_OR_NULL(debugfs_root))
rc = -ENXIO;
goto err_debugfs;
}

return 0;

err_debugfs:
unregister_blkdev(btt_major, "btt");

return rc;
}

static void __exit nd_btt_exit(void)
{
debugfs_remove_recursive(debugfs_root);
unregister_blkdev(btt_major, "btt");
}

MODULE_ALIAS_ND_DEVICE(ND_DEVICE_BTT);
Expand Down

0 comments on commit ff8e92d

Please sign in to comment.