aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_rd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-05-10 18:14:56 +0200
committerNicholas Bellinger <nab@linux-iscsi.org>2015-06-01 00:25:34 -0700
commit0a06d4309dc168dfa70cec3cf0cd9eb7fc15a2fd (patch)
tree38dda3f7dc5e049761c80b55796e48cacbb6924c /drivers/target/target_core_rd.c
parenttarget: Drop left-over se_lun->lun_status (diff)
downloadlinux-dev-0a06d4309dc168dfa70cec3cf0cd9eb7fc15a2fd.tar.xz
linux-dev-0a06d4309dc168dfa70cec3cf0cd9eb7fc15a2fd.zip
target: simplify backend driver registration
Rewrite the backend driver registration based on what we did to the fabric drivers: introduce a read-only struct target_bakckend_ops that the driver registers, which is then instanciate as a struct target_backend by the core. This allows the ops vector to be smaller and allows us to mark it const. At the same time the registration function can set up the configfs attributes, avoiding the need to add additional boilerplate code for that to the drivers. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_rd.c')
-rw-r--r--drivers/target/target_core_rd.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
index 55315fd0f5d3..cf443a8a3cbe 100644
--- a/drivers/target/target_core_rd.c
+++ b/drivers/target/target_core_rd.c
@@ -43,10 +43,6 @@ static inline struct rd_dev *RD_DEV(struct se_device *dev)
return container_of(dev, struct rd_dev, dev);
}
-/* rd_attach_hba(): (Part of se_subsystem_api_t template)
- *
- *
- */
static int rd_attach_hba(struct se_hba *hba, u32 host_id)
{
struct rd_host *rd_host;
@@ -735,7 +731,7 @@ static struct configfs_attribute *rd_mcp_backend_dev_attrs[] = {
NULL,
};
-static struct se_subsystem_api rd_mcp_template = {
+static const struct target_backend_ops rd_mcp_ops = {
.name = "rd_mcp",
.inquiry_prod = "RAMDISK-MCP",
.inquiry_rev = RD_MCP_VERSION,
@@ -751,25 +747,15 @@ static struct se_subsystem_api rd_mcp_template = {
.get_blocks = rd_get_blocks,
.init_prot = rd_init_prot,
.free_prot = rd_free_prot,
+ .tb_dev_attrib_attrs = rd_mcp_backend_dev_attrs,
};
int __init rd_module_init(void)
{
- struct target_backend_cits *tbc = &rd_mcp_template.tb_cits;
- int ret;
-
- target_core_setup_sub_cits(&rd_mcp_template);
- tbc->tb_dev_attrib_cit.ct_attrs = rd_mcp_backend_dev_attrs;
-
- ret = transport_subsystem_register(&rd_mcp_template);
- if (ret < 0) {
- return ret;
- }
-
- return 0;
+ return transport_backend_register(&rd_mcp_ops);
}
void rd_module_exit(void)
{
- transport_subsystem_release(&rd_mcp_template);
+ target_backend_unregister(&rd_mcp_ops);
}