aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2011-10-22 04:03:54 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2011-10-23 23:21:54 -0400
commitdbc5623eb2898f5b5dcdc0b16077bb3f58629c78 (patch)
treef69f4cba91f373a40bcfbbfca8b5383ee297320e
parent35e0e757537b9239172e35db773dd062727fd612 (diff)
target: transport_subsystem_check_init cleanups
Remove the now unnecessary extra call to transport_subsystem_check_init() in target_core_register_fabric(), and also merge transport_subsystem_reqmods() directly into transport_subsystem_check_init(). Reported-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/target_core_configfs.c11
-rw-r--r--drivers/target/target_core_transport.c23
-rw-r--r--include/target/target_core_transport.h2
3 files changed, 7 insertions, 29 deletions
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index f37e2b9cbbd7..1511a2ff86d8 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -132,14 +132,6 @@ static struct config_group *target_core_register_fabric(
132 pr_debug("Target_Core_ConfigFS: REGISTER -> group: %p name:" 132 pr_debug("Target_Core_ConfigFS: REGISTER -> group: %p name:"
133 " %s\n", group, name); 133 " %s\n", group, name);
134 /* 134 /*
135 * Ensure that TCM subsystem plugins are loaded at this point for
136 * using the RAMDISK_DR virtual LUN 0 and all other struct se_port
137 * LUN symlinks.
138 */
139 if (transport_subsystem_check_init() < 0)
140 return ERR_PTR(-EINVAL);
141
142 /*
143 * Below are some hardcoded request_module() calls to automatically 135 * Below are some hardcoded request_module() calls to automatically
144 * local fabric modules when the following is called: 136 * local fabric modules when the following is called:
145 * 137 *
@@ -3079,8 +3071,7 @@ static struct config_group *target_core_call_addhbatotarget(
3079 /* 3071 /*
3080 * Load up TCM subsystem plugins if they have not already been loaded. 3072 * Load up TCM subsystem plugins if they have not already been loaded.
3081 */ 3073 */
3082 if (transport_subsystem_check_init() < 0) 3074 transport_subsystem_check_init();
3083 return ERR_PTR(-EINVAL);
3084 3075
3085 hba = core_alloc_hba(se_plugin_str, plugin_dep_id, 0); 3076 hba = core_alloc_hba(se_plugin_str, plugin_dep_id, 0);
3086 if (IS_ERR(hba)) 3077 if (IS_ERR(hba))
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 774ff00b1110..06305beb61dd 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -234,10 +234,13 @@ void transport_init_queue_obj(struct se_queue_obj *qobj)
234} 234}
235EXPORT_SYMBOL(transport_init_queue_obj); 235EXPORT_SYMBOL(transport_init_queue_obj);
236 236
237static int transport_subsystem_reqmods(void) 237void transport_subsystem_check_init(void)
238{ 238{
239 int ret; 239 int ret;
240 240
241 if (sub_api_initialized)
242 return;
243
241 ret = request_module("target_core_iblock"); 244 ret = request_module("target_core_iblock");
242 if (ret != 0) 245 if (ret != 0)
243 pr_err("Unable to load target_core_iblock\n"); 246 pr_err("Unable to load target_core_iblock\n");
@@ -254,24 +257,8 @@ static int transport_subsystem_reqmods(void)
254 if (ret != 0) 257 if (ret != 0)
255 pr_err("Unable to load target_core_stgt\n"); 258 pr_err("Unable to load target_core_stgt\n");
256 259
257 return 0;
258}
259
260int transport_subsystem_check_init(void)
261{
262 int ret;
263
264 if (sub_api_initialized)
265 return 0;
266 /*
267 * Request the loading of known TCM subsystem plugins..
268 */
269 ret = transport_subsystem_reqmods();
270 if (ret < 0)
271 return ret;
272
273 sub_api_initialized = 1; 260 sub_api_initialized = 1;
274 return 0; 261 return;
275} 262}
276 263
277struct se_session *transport_init_session(void) 264struct se_session *transport_init_session(void)
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h
index c8538c5d3fbf..32c586346c0e 100644
--- a/include/target/target_core_transport.h
+++ b/include/target/target_core_transport.h
@@ -113,7 +113,7 @@ extern int init_se_kmem_caches(void);
113extern void release_se_kmem_caches(void); 113extern void release_se_kmem_caches(void);
114extern u32 scsi_get_new_index(scsi_index_t); 114extern u32 scsi_get_new_index(scsi_index_t);
115extern void transport_init_queue_obj(struct se_queue_obj *); 115extern void transport_init_queue_obj(struct se_queue_obj *);
116extern int transport_subsystem_check_init(void); 116extern void transport_subsystem_check_init(void);
117extern int transport_subsystem_register(struct se_subsystem_api *); 117extern int transport_subsystem_register(struct se_subsystem_api *);
118extern void transport_subsystem_release(struct se_subsystem_api *); 118extern void transport_subsystem_release(struct se_subsystem_api *);
119extern void transport_load_plugins(void); 119extern void transport_load_plugins(void);