diff options
author | Johannes Thumshirn <jthumshirn@suse.de> | 2017-01-27 03:03:45 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-02-22 15:34:00 -0500 |
commit | e5a39dd8238e5d42c830bbd8d31211adf6fea6ca (patch) | |
tree | a261dc1b1658d73b1de0ba237f26abed4e967276 | |
parent | 986994a27587efd8ce4c595cab89b570f7475359 (diff) |
nvme: make nvmf_register_transport require a create_ctrl callback
nvmf_create_ctrl() relys on the presence of a create_crtl callback in the
registered nvmf_transport_ops, so make nvmf_register_transport require one.
Update the available call-sites as well to reflect these changes.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | drivers/nvme/host/fabrics.c | 7 | ||||
-rw-r--r-- | drivers/nvme/host/fabrics.h | 2 | ||||
-rw-r--r-- | drivers/nvme/host/fc.c | 3 | ||||
-rw-r--r-- | drivers/nvme/host/rdma.c | 3 | ||||
-rw-r--r-- | drivers/nvme/target/loop.c | 3 |
5 files changed, 10 insertions, 8 deletions
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c index 916d13608059..5b7386f69f4d 100644 --- a/drivers/nvme/host/fabrics.c +++ b/drivers/nvme/host/fabrics.c | |||
@@ -480,11 +480,16 @@ EXPORT_SYMBOL_GPL(nvmf_connect_io_queue); | |||
480 | * being implemented to the common NVMe fabrics library. Part of | 480 | * being implemented to the common NVMe fabrics library. Part of |
481 | * the overall init sequence of starting up a fabrics driver. | 481 | * the overall init sequence of starting up a fabrics driver. |
482 | */ | 482 | */ |
483 | void nvmf_register_transport(struct nvmf_transport_ops *ops) | 483 | int nvmf_register_transport(struct nvmf_transport_ops *ops) |
484 | { | 484 | { |
485 | if (!ops->create_ctrl) | ||
486 | return -EINVAL; | ||
487 | |||
485 | mutex_lock(&nvmf_transports_mutex); | 488 | mutex_lock(&nvmf_transports_mutex); |
486 | list_add_tail(&ops->entry, &nvmf_transports); | 489 | list_add_tail(&ops->entry, &nvmf_transports); |
487 | mutex_unlock(&nvmf_transports_mutex); | 490 | mutex_unlock(&nvmf_transports_mutex); |
491 | |||
492 | return 0; | ||
488 | } | 493 | } |
489 | EXPORT_SYMBOL_GPL(nvmf_register_transport); | 494 | EXPORT_SYMBOL_GPL(nvmf_register_transport); |
490 | 495 | ||
diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h index 924145c979f1..156018182ce4 100644 --- a/drivers/nvme/host/fabrics.h +++ b/drivers/nvme/host/fabrics.h | |||
@@ -128,7 +128,7 @@ int nvmf_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val); | |||
128 | int nvmf_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val); | 128 | int nvmf_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val); |
129 | int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl); | 129 | int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl); |
130 | int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid); | 130 | int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid); |
131 | void nvmf_register_transport(struct nvmf_transport_ops *ops); | 131 | int nvmf_register_transport(struct nvmf_transport_ops *ops); |
132 | void nvmf_unregister_transport(struct nvmf_transport_ops *ops); | 132 | void nvmf_unregister_transport(struct nvmf_transport_ops *ops); |
133 | void nvmf_free_options(struct nvmf_ctrl_options *opts); | 133 | void nvmf_free_options(struct nvmf_ctrl_options *opts); |
134 | const char *nvmf_get_subsysnqn(struct nvme_ctrl *ctrl); | 134 | const char *nvmf_get_subsysnqn(struct nvme_ctrl *ctrl); |
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index fb51a8de9b29..6186fde718f9 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c | |||
@@ -2562,8 +2562,7 @@ static int __init nvme_fc_init_module(void) | |||
2562 | if (!nvme_fc_wq) | 2562 | if (!nvme_fc_wq) |
2563 | return -ENOMEM; | 2563 | return -ENOMEM; |
2564 | 2564 | ||
2565 | nvmf_register_transport(&nvme_fc_transport); | 2565 | return nvmf_register_transport(&nvme_fc_transport); |
2566 | return 0; | ||
2567 | } | 2566 | } |
2568 | 2567 | ||
2569 | static void __exit nvme_fc_exit_module(void) | 2568 | static void __exit nvme_fc_exit_module(void) |
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index a75e95d42b3f..aedac6e28c6f 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c | |||
@@ -2063,8 +2063,7 @@ static int __init nvme_rdma_init_module(void) | |||
2063 | return ret; | 2063 | return ret; |
2064 | } | 2064 | } |
2065 | 2065 | ||
2066 | nvmf_register_transport(&nvme_rdma_transport); | 2066 | return nvmf_register_transport(&nvme_rdma_transport); |
2067 | return 0; | ||
2068 | } | 2067 | } |
2069 | 2068 | ||
2070 | static void __exit nvme_rdma_cleanup_module(void) | 2069 | static void __exit nvme_rdma_cleanup_module(void) |
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c index f3862e38f574..d1f06e7768ff 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c | |||
@@ -724,8 +724,7 @@ static int __init nvme_loop_init_module(void) | |||
724 | ret = nvmet_register_transport(&nvme_loop_ops); | 724 | ret = nvmet_register_transport(&nvme_loop_ops); |
725 | if (ret) | 725 | if (ret) |
726 | return ret; | 726 | return ret; |
727 | nvmf_register_transport(&nvme_loop_transport); | 727 | return nvmf_register_transport(&nvme_loop_transport); |
728 | return 0; | ||
729 | } | 728 | } |
730 | 729 | ||
731 | static void __exit nvme_loop_cleanup_module(void) | 730 | static void __exit nvme_loop_cleanup_module(void) |