From patchwork Wed Aug 8 02:31:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: UBI:Force ubi driver load after mtd device drivers Date: Tue, 07 Aug 2012 16:31:01 -0000 From: Jiang Lu X-Patchwork-Id: 175839 Message-Id: <1344393061-21037-1-git-send-email-lu.jiang@windriver.com> To: To implement rootfs on mtd device with UBIFS, kernel need create a UBIFS device when booting: drivers/mtd/ubi/build.c ubi_init() for (i = 0; i < mtd_devs; i++) { ... mtd = open_mtd_device(p->name); if (IS_ERR(mtd)) { err = PTR_ERR(mtd); goto out_detach; } ubi_attach_mtd_dev() ... } module_init(ubi_init); Kernel can not create the UBIFS device without corresponding mtd partiton. Some NAND device can not guarenteen the mtd patition created before UBIFS deivce driver loading. Such as SPI NAND deivce, the mtd partition will create after SPI bus driver loaded. UBI device driver must load after other mtd device drivers to make sure the mtd partition already exist when creating UBI deivce. The patch updates the UBI device driver's initial routine to late_initcall level. Signed-off-by: Jiang Lu --- drivers/mtd/ubi/build.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 0fde9fc..efbcaef 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -1275,7 +1275,7 @@ out: ubi_err("UBI error: cannot initialize UBI, error %d", err); return err; } -module_init(ubi_init); +late_initcall(ubi_init); static void __exit ubi_exit(void) {