Skip to content

Commit

Permalink
nvme: make nvmf_register_transport require a create_ctrl callback
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Thumshirn authored and Jens Axboe committed Feb 22, 2017
1 parent 986994a commit e5a39dd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
7 changes: 6 additions & 1 deletion drivers/nvme/host/fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,16 @@ EXPORT_SYMBOL_GPL(nvmf_connect_io_queue);
* being implemented to the common NVMe fabrics library. Part of
* the overall init sequence of starting up a fabrics driver.
*/
void nvmf_register_transport(struct nvmf_transport_ops *ops)
int nvmf_register_transport(struct nvmf_transport_ops *ops)
{
if (!ops->create_ctrl)
return -EINVAL;

mutex_lock(&nvmf_transports_mutex);
list_add_tail(&ops->entry, &nvmf_transports);
mutex_unlock(&nvmf_transports_mutex);

return 0;
}
EXPORT_SYMBOL_GPL(nvmf_register_transport);

Expand Down
2 changes: 1 addition & 1 deletion drivers/nvme/host/fabrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ int nvmf_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val);
int nvmf_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val);
int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl);
int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid);
void nvmf_register_transport(struct nvmf_transport_ops *ops);
int nvmf_register_transport(struct nvmf_transport_ops *ops);
void nvmf_unregister_transport(struct nvmf_transport_ops *ops);
void nvmf_free_options(struct nvmf_ctrl_options *opts);
const char *nvmf_get_subsysnqn(struct nvme_ctrl *ctrl);
Expand Down
3 changes: 1 addition & 2 deletions drivers/nvme/host/fc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2562,8 +2562,7 @@ static int __init nvme_fc_init_module(void)
if (!nvme_fc_wq)
return -ENOMEM;

nvmf_register_transport(&nvme_fc_transport);
return 0;
return nvmf_register_transport(&nvme_fc_transport);
}

static void __exit nvme_fc_exit_module(void)
Expand Down
3 changes: 1 addition & 2 deletions drivers/nvme/host/rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -2063,8 +2063,7 @@ static int __init nvme_rdma_init_module(void)
return ret;
}

nvmf_register_transport(&nvme_rdma_transport);
return 0;
return nvmf_register_transport(&nvme_rdma_transport);
}

static void __exit nvme_rdma_cleanup_module(void)
Expand Down
3 changes: 1 addition & 2 deletions drivers/nvme/target/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,7 @@ static int __init nvme_loop_init_module(void)
ret = nvmet_register_transport(&nvme_loop_ops);
if (ret)
return ret;
nvmf_register_transport(&nvme_loop_transport);
return 0;
return nvmf_register_transport(&nvme_loop_transport);
}

static void __exit nvme_loop_cleanup_module(void)
Expand Down

0 comments on commit e5a39dd

Please sign in to comment.