Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: spectra: asynchronous init

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Yong Wang and committed by
Greg Kroah-Hartman
63fcf10d 6f5a4162

+9 -4
+9 -4
drivers/staging/spectra/ffsport.c
··· 28 28 #include <linux/log2.h> 29 29 #include <linux/init.h> 30 30 #include <linux/slab.h> 31 + #include <linux/async.h> 31 32 32 33 /**** Helper functions used for Div, Remainder operation on u64 ****/ 33 34 ··· 730 729 } 731 730 */ 732 731 733 - int register_spectra_ftl() 732 + static void register_spectra_ftl_async(void *unused, async_cookie_t cookie) 734 733 { 735 734 int i; 736 735 ··· 739 738 if (PASS != GLOB_FTL_IdentifyDevice(&IdentifyDeviceData)) { 740 739 printk(KERN_ERR "Spectra: Unable to Read Flash Device. " 741 740 "Aborting\n"); 742 - return -ENOMEM; 741 + return; 743 742 } else { 744 743 nand_dbg_print(NAND_DBG_WARN, "In GLOB_SBD_init: " 745 744 "Num blocks=%d, pagesperblock=%d, " ··· 773 772 "Spectra: module loaded with major number %d\n", 774 773 GLOB_SBD_majornum); 775 774 776 - return PASS; 775 + return; 777 776 778 777 out_blk_register: 779 778 unregister_blkdev(GLOB_SBD_majornum, GLOB_SBD_NAME); 780 779 out_ftl_flash_register: 781 780 GLOB_FTL_Cache_Release(); 782 781 printk(KERN_ERR "Spectra: Module load failed.\n"); 782 + } 783 783 784 - return FAIL; 784 + int register_spectra_ftl() 785 + { 786 + async_schedule(register_spectra_ftl_async, NULL); 787 + return 0; 785 788 } 786 789 EXPORT_SYMBOL_GPL(register_spectra_ftl); 787 790