aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/sbp/sbp_target.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/target/sbp/sbp_target.c')
-rw-r--r--drivers/target/sbp/sbp_target.c68
1 files changed, 10 insertions, 58 deletions
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
index 9512af6a8114..18b0f9703ff2 100644
--- a/drivers/target/sbp/sbp_target.c
+++ b/drivers/target/sbp/sbp_target.c
@@ -42,8 +42,7 @@
42 42
43#include "sbp_target.h" 43#include "sbp_target.h"
44 44
45/* Local pointer to allocated TCM configfs fabric module */ 45static const struct target_core_fabric_ops sbp_ops;
46static struct target_fabric_configfs *sbp_fabric_configfs;
47 46
48/* FireWire address region for management and command block address handlers */ 47/* FireWire address region for management and command block address handlers */
49static const struct fw_address_region sbp_register_region = { 48static const struct fw_address_region sbp_register_region = {
@@ -2215,8 +2214,7 @@ static struct se_portal_group *sbp_make_tpg(
2215 goto out_free_tpg; 2214 goto out_free_tpg;
2216 } 2215 }
2217 2216
2218 ret = core_tpg_register(&sbp_fabric_configfs->tf_ops, wwn, 2217 ret = core_tpg_register(&sbp_ops, wwn, &tpg->se_tpg, tpg,
2219 &tpg->se_tpg, (void *)tpg,
2220 TRANSPORT_TPG_TYPE_NORMAL); 2218 TRANSPORT_TPG_TYPE_NORMAL);
2221 if (ret < 0) 2219 if (ret < 0)
2222 goto out_unreg_mgt_agt; 2220 goto out_unreg_mgt_agt;
@@ -2503,7 +2501,9 @@ static struct configfs_attribute *sbp_tpg_attrib_attrs[] = {
2503 NULL, 2501 NULL,
2504}; 2502};
2505 2503
2506static struct target_core_fabric_ops sbp_ops = { 2504static const struct target_core_fabric_ops sbp_ops = {
2505 .module = THIS_MODULE,
2506 .name = "sbp",
2507 .get_fabric_name = sbp_get_fabric_name, 2507 .get_fabric_name = sbp_get_fabric_name,
2508 .get_fabric_proto_ident = sbp_get_fabric_proto_ident, 2508 .get_fabric_proto_ident = sbp_get_fabric_proto_ident,
2509 .tpg_get_wwn = sbp_get_fabric_wwn, 2509 .tpg_get_wwn = sbp_get_fabric_wwn,
@@ -2544,68 +2544,20 @@ static struct target_core_fabric_ops sbp_ops = {
2544 .fabric_drop_np = NULL, 2544 .fabric_drop_np = NULL,
2545 .fabric_make_nodeacl = sbp_make_nodeacl, 2545 .fabric_make_nodeacl = sbp_make_nodeacl,
2546 .fabric_drop_nodeacl = sbp_drop_nodeacl, 2546 .fabric_drop_nodeacl = sbp_drop_nodeacl,
2547};
2548
2549static int sbp_register_configfs(void)
2550{
2551 struct target_fabric_configfs *fabric;
2552 int ret;
2553
2554 fabric = target_fabric_configfs_init(THIS_MODULE, "sbp");
2555 if (IS_ERR(fabric)) {
2556 pr_err("target_fabric_configfs_init() failed\n");
2557 return PTR_ERR(fabric);
2558 }
2559
2560 fabric->tf_ops = sbp_ops;
2561
2562 /*
2563 * Setup default attribute lists for various fabric->tf_cit_tmpl
2564 */
2565 fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = sbp_wwn_attrs;
2566 fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = sbp_tpg_base_attrs;
2567 fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = sbp_tpg_attrib_attrs;
2568 fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL;
2569 fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL;
2570 fabric->tf_cit_tmpl.tfc_tpg_nacl_base_cit.ct_attrs = NULL;
2571 fabric->tf_cit_tmpl.tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;
2572 fabric->tf_cit_tmpl.tfc_tpg_nacl_auth_cit.ct_attrs = NULL;
2573 fabric->tf_cit_tmpl.tfc_tpg_nacl_param_cit.ct_attrs = NULL;
2574
2575 ret = target_fabric_configfs_register(fabric);
2576 if (ret < 0) {
2577 pr_err("target_fabric_configfs_register() failed for SBP\n");
2578 return ret;
2579 }
2580 2547
2581 sbp_fabric_configfs = fabric; 2548 .tfc_wwn_attrs = sbp_wwn_attrs,
2582 2549 .tfc_tpg_base_attrs = sbp_tpg_base_attrs,
2583 return 0; 2550 .tfc_tpg_attrib_attrs = sbp_tpg_attrib_attrs,
2584};
2585
2586static void sbp_deregister_configfs(void)
2587{
2588 if (!sbp_fabric_configfs)
2589 return;
2590
2591 target_fabric_configfs_deregister(sbp_fabric_configfs);
2592 sbp_fabric_configfs = NULL;
2593}; 2551};
2594 2552
2595static int __init sbp_init(void) 2553static int __init sbp_init(void)
2596{ 2554{
2597 int ret; 2555 return target_register_template(&sbp_ops);
2598
2599 ret = sbp_register_configfs();
2600 if (ret < 0)
2601 return ret;
2602
2603 return 0;
2604}; 2556};
2605 2557
2606static void __exit sbp_exit(void) 2558static void __exit sbp_exit(void)
2607{ 2559{
2608 sbp_deregister_configfs(); 2560 target_unregister_template(&sbp_ops);
2609}; 2561};
2610 2562
2611MODULE_DESCRIPTION("FireWire SBP fabric driver"); 2563MODULE_DESCRIPTION("FireWire SBP fabric driver");