public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: nab@linux-iscsi.org
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH 1/2] target-stgt: fix initializaiton
Date: Tue, 16 Nov 2010 12:58:07 -0500	[thread overview]
Message-ID: <20101116175807.GA26311@infradead.org> (raw)

It looks like STGT got left behind when removing the plugin_init/free methods.
Change it to initialize/remove its device in module_init/exit and drop the
leftovers of the plugin_init/free methods.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: lio-core/drivers/target/target_core_stgt.c
===================================================================
--- lio-core.orig/drivers/target/target_core_stgt.c	2010-11-16 18:40:09.693004611 +0100
+++ lio-core/drivers/target/target_core_stgt.c	2010-11-16 18:43:57.511253529 +0100
@@ -113,49 +113,6 @@ static void stgt_release_adapter(struct
 	kfree(stgt_hba);
 }
 
-static int stgt_plugin_init(void)
-{
-	int ret;
-
-	ret = device_register(&stgt_primary);
-	if (ret) {
-		printk(KERN_ERR "device_register() failed for stgt_primary\n");
-		return ret;
-	}
-
-	ret = bus_register(&stgt_lld_bus);
-	if (ret) {
-		printk(KERN_ERR "bus_register() failed for stgt_ldd_bus\n");
-		goto dev_unreg;
-	}
-
-	ret = driver_register(&stgt_driverfs_driver);
-	if (ret) {
-		printk(KERN_ERR "driver_register() failed for"
-			" stgt_driverfs_driver\n");
-		goto bus_unreg;
-	}
-	stgt_host_no_cnt = 0;
-
-	printk(KERN_INFO "CORE_STGT[0]: Bus Initalization complete\n");
-	return 0;
-
-bus_unreg:
-	bus_unregister(&stgt_lld_bus);
-dev_unreg:
-	device_unregister(&stgt_primary);
-	return ret;
-}
-
-static void stgt_plugin_free(void)
-{
-	driver_unregister(&stgt_driverfs_driver);
-	bus_unregister(&stgt_lld_bus);
-	device_unregister(&stgt_primary);
-
-	printk(KERN_INFO "CORE_STGT[0]: Bus release complete\n");
-}
-
 /*	stgt_attach_hba():
  *
  */
@@ -680,8 +637,6 @@ static struct se_subsystem_api stgt_temp
 	.check_configfs_dev_params = stgt_check_configfs_dev_params,
 	.set_configfs_dev_params = stgt_set_configfs_dev_params,
 	.show_configfs_dev_params = stgt_show_configfs_dev_params,
-	.plugin_init		= stgt_plugin_init,
-	.plugin_free		= stgt_plugin_free,
 	.get_plugin_info	= stgt_get_plugin_info,
 	.get_hba_info		= stgt_get_hba_info,
 	.check_lba		= stgt_check_lba,
@@ -694,12 +649,48 @@ static struct se_subsystem_api stgt_temp
 
 static int __init stgt_module_init(void)
 {
-	return transport_subsystem_register(&stgt_template);
+	int ret;
+
+	ret = device_register(&stgt_primary);
+	if (ret) {
+		printk(KERN_ERR "device_register() failed for stgt_primary\n");
+		return ret;
+	}
+
+	ret = bus_register(&stgt_lld_bus);
+	if (ret) {
+		printk(KERN_ERR "bus_register() failed for stgt_ldd_bus\n");
+		goto out_unregister_device;
+	}
+
+	ret = driver_register(&stgt_driverfs_driver);
+	if (ret) {
+		printk(KERN_ERR "driver_register() failed for"
+			" stgt_driverfs_driver\n");
+		goto out_unregister_bus;
+	}
+
+	ret = transport_subsystem_register(&stgt_template);
+	if (ret)
+		goto out_unregister_driver;
+
+	return 0;
+out_unregister_driver:
+	driver_unregister(&stgt_driverfs_driver);
+out_unregister_bus:
+	bus_unregister(&stgt_lld_bus);
+out_unregister_device:
+	device_unregister(&stgt_primary);
+	return ret;
 }
 
 static void stgt_module_exit(void)
 {
 	transport_subsystem_release(&stgt_template);
+
+	driver_unregister(&stgt_driverfs_driver);
+	bus_unregister(&stgt_lld_bus);
+	device_unregister(&stgt_primary);
 }
 
 MODULE_DESCRIPTION("TCM STGT subsystem plugin");
Index: lio-core/include/target/target_core_transport.h
===================================================================
--- lio-core.orig/include/target/target_core_transport.h	2010-11-16 18:42:38.925004541 +0100
+++ lio-core/include/target/target_core_transport.h	2010-11-16 18:42:56.769254717 +0100
@@ -410,14 +410,6 @@ struct se_subsystem_api {
 	ssize_t (*show_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *,
 						char *);
 	/*
-	 * plugin_init():
-	 */
-	int (*plugin_init)(void);
-	/*
-	 * plugin_free():
-	 */
-	void (*plugin_free)(void);
-	/*
 	 * get_plugin_info():
 	 */
 	void (*get_plugin_info)(void *, char *, int *);

             reply	other threads:[~2010-11-16 17:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-16 17:58 Christoph Hellwig [this message]
2010-11-17 19:50 ` [PATCH 1/2] target-stgt: fix initializaiton Nicholas A. Bellinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101116175807.GA26311@infradead.org \
    --to=hch@infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox