Commit 5f568556 authored by James Smart's avatar James Smart Committed by Christoph Hellwig

nvme-fc: create fc class and transport device

Added a new fc class and a device node for udev events under it.  I
expect the fc class will eventually be the location where the FC SCSI and
FC NVME merge in the future. Therefore names are kept somewhat generic.
Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent eaefd5ab
...@@ -213,6 +213,13 @@ static DEFINE_IDA(nvme_fc_ctrl_cnt); ...@@ -213,6 +213,13 @@ static DEFINE_IDA(nvme_fc_ctrl_cnt);
/*
* These items are short-term. They will eventually be moved into
* a generic FC class. See comments in module init.
*/
static struct class *fc_class;
static struct device *fc_udev_device;
/* *********************** FC-NVME Port Management ************************ */ /* *********************** FC-NVME Port Management ************************ */
...@@ -3046,7 +3053,50 @@ static struct nvmf_transport_ops nvme_fc_transport = { ...@@ -3046,7 +3053,50 @@ static struct nvmf_transport_ops nvme_fc_transport = {
static int __init nvme_fc_init_module(void) static int __init nvme_fc_init_module(void)
{ {
return nvmf_register_transport(&nvme_fc_transport); int ret;
/*
* NOTE:
* It is expected that in the future the kernel will combine
* the FC-isms that are currently under scsi and now being
* added to by NVME into a new standalone FC class. The SCSI
* and NVME protocols and their devices would be under this
* new FC class.
*
* As we need something to post FC-specific udev events to,
* specifically for nvme probe events, start by creating the
* new device class. When the new standalone FC class is
* put in place, this code will move to a more generic
* location for the class.
*/
fc_class = class_create(THIS_MODULE, "fc");
if (IS_ERR(fc_class)) {
pr_err("couldn't register class fc\n");
return PTR_ERR(fc_class);
}
/*
* Create a device for the FC-centric udev events
*/
fc_udev_device = device_create(fc_class, NULL, MKDEV(0, 0), NULL,
"fc_udev_device");
if (IS_ERR(fc_udev_device)) {
pr_err("couldn't create fc_udev device!\n");
ret = PTR_ERR(fc_udev_device);
goto out_destroy_class;
}
ret = nvmf_register_transport(&nvme_fc_transport);
if (ret)
goto out_destroy_device;
return 0;
out_destroy_device:
device_destroy(fc_class, MKDEV(0, 0));
out_destroy_class:
class_destroy(fc_class);
return ret;
} }
static void __exit nvme_fc_exit_module(void) static void __exit nvme_fc_exit_module(void)
...@@ -3059,6 +3109,9 @@ static void __exit nvme_fc_exit_module(void) ...@@ -3059,6 +3109,9 @@ static void __exit nvme_fc_exit_module(void)
ida_destroy(&nvme_fc_local_port_cnt); ida_destroy(&nvme_fc_local_port_cnt);
ida_destroy(&nvme_fc_ctrl_cnt); ida_destroy(&nvme_fc_ctrl_cnt);
device_destroy(fc_class, MKDEV(0, 0));
class_destroy(fc_class);
} }
module_init(nvme_fc_init_module); module_init(nvme_fc_init_module);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment