]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/mtd/nand/raw/omap2.c
mtd: rawnand: omap2: Use nand_controller_init()
[linux.git] / drivers / mtd / nand / raw / omap2.c
index 68e8b9f7f372a71618837e6a39e88d373c59ed3b..eb6ec332624a89b20253bc029a970bb46a3c8b18 100644 (file)
@@ -2173,11 +2173,8 @@ static const struct nand_controller_ops omap_nand_controller_ops = {
 };
 
 /* Shared among all NAND instances to synchronize access to the ECC Engine */
-static struct nand_controller omap_gpmc_controller = {
-       .lock = __SPIN_LOCK_UNLOCKED(omap_gpmc_controller.lock),
-       .wq = __WAIT_QUEUE_HEAD_INITIALIZER(omap_gpmc_controller.wq),
-       .ops = &omap_nand_controller_ops,
-};
+static struct nand_controller omap_gpmc_controller;
+static bool omap_gpmc_controller_initialized;
 
 static int omap_nand_probe(struct platform_device *pdev)
 {
@@ -2227,6 +2224,12 @@ static int omap_nand_probe(struct platform_device *pdev)
 
        info->phys_base = res->start;
 
+       if (!omap_gpmc_controller_initialized) {
+               omap_gpmc_controller.ops = &omap_nand_controller_ops;
+               nand_controller_init(&omap_gpmc_controller);
+               omap_gpmc_controller_initialized = true;
+       }
+
        nand_chip->controller = &omap_gpmc_controller;
 
        nand_chip->legacy.IO_ADDR_W = nand_chip->legacy.IO_ADDR_R;