mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yong Wang <yong.y.wang@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Arjan van de Ven <arjan@linux.intel.com>,
	chuanxiao.dong@intel.com, yunpeng.gao@intel.com,
	linux-kernel@vger.kernel.org
Subject: [PATCH] staging: spectra: asynchronous init
Date: Wed, 17 Nov 2010 22:09:54 +0800	[thread overview]
Message-ID: <20101117140954.GB5790@ywang-moblin2.bj.intel.com> (raw)

The spectra nand driver takes quite some time to initialize because
it needs to scan the whole nand disk to find the latest block table.
This patch initializes the spectra nand driver asynchronously so that
other things in the kernel can initialize in parallel to the scanning
operation.

Signed-off-by: Yong Wang <yong.y.wang@intel.com>
---
 drivers/staging/spectra/ffsport.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/spectra/ffsport.c b/drivers/staging/spectra/ffsport.c
index ae101a2..007b24b 100644
--- a/drivers/staging/spectra/ffsport.c
+++ b/drivers/staging/spectra/ffsport.c
@@ -28,6 +28,7 @@
 #include <linux/log2.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/async.h>
 
 /**** Helper functions used for Div, Remainder operation on u64 ****/
 
@@ -729,7 +730,7 @@ static void create_sysfs_entry(struct device *dev)
 }
 */
 
-int register_spectra_ftl()
+static void register_spectra_ftl_async(void *unused, async_cookie_t cookie)
 {
 	int i;
 
@@ -738,7 +739,7 @@ int register_spectra_ftl()
 	if (PASS != GLOB_FTL_IdentifyDevice(&IdentifyDeviceData)) {
 		printk(KERN_ERR "Spectra: Unable to Read Flash Device. "
 		       "Aborting\n");
-		return -ENOMEM;
+		return;
 	} else {
 		nand_dbg_print(NAND_DBG_WARN, "In GLOB_SBD_init: "
 			       "Num blocks=%d, pagesperblock=%d, "
@@ -772,15 +773,19 @@ int register_spectra_ftl()
 		       "Spectra: module loaded with major number %d\n",
 		       GLOB_SBD_majornum);
 
-	return PASS;
+	return;
 
 out_blk_register:
 	unregister_blkdev(GLOB_SBD_majornum, GLOB_SBD_NAME);
 out_ftl_flash_register:
 	GLOB_FTL_Cache_Release();
 	printk(KERN_ERR "Spectra: Module load failed.\n");
+}
 
-	return FAIL;
+int register_spectra_ftl()
+{
+	async_schedule(register_spectra_ftl_async, NULL);
+	return 0;
 }
 EXPORT_SYMBOL_GPL(register_spectra_ftl);
 
-- 
1.5.5.1


                 reply	other threads:[~2010-11-17 14:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20101117140954.GB5790@ywang-moblin2.bj.intel.com \
    --to=yong.y.wang@linux.intel.com \
    --cc=arjan@linux.intel.com \
    --cc=chuanxiao.dong@intel.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yunpeng.gao@intel.com \
    /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

all inboxes | Powered by JetHome®