summaryrefslogtreecommitdiff
path: root/drivers/nvdimm/bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/nvdimm/bus.c')
-rw-r--r--drivers/nvdimm/bus.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 3f7c690a5d0c..a8802577fb55 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -13,6 +13,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/uaccess.h>
#include <linux/fcntl.h>
+#include <linux/async.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/io.h>
@@ -21,6 +22,10 @@
static int nvdimm_bus_major;
static struct class *nd_class;
+struct bus_type nvdimm_bus_type = {
+ .name = "nd",
+};
+
int nvdimm_bus_create_ndctl(struct nvdimm_bus *nvdimm_bus)
{
dev_t devt = MKDEV(nvdimm_bus_major, nvdimm_bus->id);
@@ -59,9 +64,13 @@ int __init nvdimm_bus_init(void)
{
int rc;
+ rc = bus_register(&nvdimm_bus_type);
+ if (rc)
+ return rc;
+
rc = register_chrdev(0, "ndctl", &nvdimm_bus_fops);
if (rc < 0)
- return rc;
+ goto err_chrdev;
nvdimm_bus_major = rc;
nd_class = class_create(THIS_MODULE, "nd");
@@ -72,6 +81,8 @@ int __init nvdimm_bus_init(void)
err_class:
unregister_chrdev(nvdimm_bus_major, "ndctl");
+ err_chrdev:
+ bus_unregister(&nvdimm_bus_type);
return rc;
}
@@ -80,4 +91,5 @@ void __exit nvdimm_bus_exit(void)
{
class_destroy(nd_class);
unregister_chrdev(nvdimm_bus_major, "ndctl");
+ bus_unregister(&nvdimm_bus_type);
}